I am not sure how to get the absolute path from __FILE__ macro in Borland C++ Compiler. When I use it in my program I am only getting the file name. Is there some setting through which we can get the complete path. Please help ASAP.
__FILE__ in Borland C++
Use the dot operator (.) to get the path to the current folder and join __FILE__ with it to get the complete path.
How am I supposed to use . operator in say a printf statement. Please illustrate.
printf would not solve the issue but you can use to open a file in the current folder and get its path and then print it. I am not sure about the Borland but its a general way of doing thing.
Not sure about Borland, but if you set your compiler options to "use full path" (there's often a command-line equivalent), then __FILE__ includes the path.
I figured out that one way of doing this would be to make use of the GetFullPathName function provided by the Windows SDK. :-)
you can use GetModuleName get the application full path,then get the dir from it ,..