Interview Questions

How can I automatically locate a programs configuration files in the same directory as the executable?

C Interview Questions and Answers


(Continued from previous question...)

How can I automatically locate a programs configuration files in the same directory as the executable?

It's hard, in general; Even if you can figure out a workable way to do it, you might want to consider making the program's auxiliary (library) directory configurable, perhaps with an environment variable. (It's especially important to allow variable placement of a program's configuration files when the program will be used by several people, e.g. on a multiuser system.)

(Continued on next question...)

Other Interview Questions