I want to fix an old C program (got the source) that uses relative paths to load data files, expecting the executable is called from the directory where it is placed, such as LoadEx("./dataFile", dataFile); Of course calling the program from another directory fails since the dataFile cannot be loaded.
How can I modify the C program to load dataFiles relative to the executable's directory?
EDIT: My original question turned inapplicable and so is a duplicate to at least: - How do I find the location of the executable in C? - How to open a file with it's relative path in Linux? - Finding current executable's path without /proc/self/exe
 
     
    