Basic and Advance C Question:
Download Questions PDF

How can my program discover the complete pathname to the executable from which it was invoked?

Answer:

argv[0] may contain all or part of the pathname, or it may contain nothing. You may be able to duplicate the command language interpreter's search path logic to locate the executable if the name in argv[0] is present but incomplete. However, there is no guaranteed solution.

Download C Programming Interview Questions And Answers PDF

Previous QuestionNext Question
How can I automatically locate a programs configuration files in the same directory as the executable?How can I invoke another program or command and trap its output?