Basic and Advance C Question:
Download Questions PDF

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

Answer:

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.)

Download C Programming Interview Questions And Answers PDF

Previous QuestionNext Question
How can a process change an environment variable in its caller?How can my program discover the complete pathname to the executable from which it was invoked?