__FILE__ in Borland C++

ashish_onmobile's Avatar, Join Date: Jan 2007
Newbie Member
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.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Use the dot operator (.) to get the path to the current folder and join __FILE__ with it to get the complete path.
0
ashish_onmobile's Avatar, Join Date: Jan 2007
Newbie Member
How am I supposed to use . operator in say a printf statement. Please illustrate.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
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.
0
ashish_onmobile's Avatar, Join Date: Jan 2007
Newbie Member
I figured out that one way of doing this would be to make use of the GetFullPathName function provided by the Windows SDK. :-)
0
findingit's Avatar
Newbie Member
you can use GetModuleName get the application full path,then get the dir from it ,..
0
findingit's Avatar
Newbie Member
GetModuleFileName