I have a question related to how relative paths are interpreted in various environments . If I have a C code to be compiled on linux using Makefile and gcc , and if some source file has :
fopen(“../../xyz.ctl”, ”r”);
where should this file be located. Or in other words, if I have
fopen(“xyz.ctl” , ”r”);
would the compiler look for xyz.ctl in same folder as the:-
a.) Where source file having this statement fopen is present?
b.) Where makefile is present ?
c.) Where the linux executable would be generated ?
I know that MSVC all relative paths are from the folder which has the *.dsw (workspace file). For RVDS environment it begins from the folder where the executable *.axf is generated.
-AD
Your Makefile invokes gcc which compiles your code containing fopen(). fopen() is called when you execute the newly compiled code. The path is relative to your current working directory when you launched the program.