I have used macros in following way in my .cpp file named Test.cpp which is present in the location c:\Test\Test.cpp
Inside test.cpp
#define FILE_NAME strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__
#define S1(x) #x
#define S2(x) S1(x)
#define LOCATION FILE_NAME " : " S2(__LINE__)
//#define LOCATION __FILE__" : " S2(__LINE__) Working but giving the whole file path where as i need only Filename:Line number
Inside Function
{
::MessageBox(NULL,LOCATION,"Test",MB_OK); //Here i am getting only Filename .
}
Please help me in writing a MACRO so that i can get both Filename(Not the full path , only Filename) and Line number in my application .