In my program I use chdir a number of times, and was wondering if there is a function that returns the directory in which the program is contained? I am looking for an alternative to:
1) create a global variable original_root to store the path in at the beginning of program
2) call getcwd(".") and store the returned value in variable original_root
Essentially, I'm wondering if there is some function that can be called at any time to give the path to the directory from which the program is being run, thus avoiding the need to save this directory in some variable. Thanks in advance!