__FILE__ is replaced with \"MyFile.cpp\" by C++ preprocessor. I want __LINE__ to be replaced with \"256\" string not with 256 integer. Without using m
__FILE__
__LINE__
EDIT: In response to request on the other answer, I added a non-macro version:
#include #include #include #define B(x) #x #define A(x) B(x) void f(const char *s) { std::cout << s << "\n"; } int main() { f(A(__LINE__)); f(boost::lexical_cast(__LINE__).c_str()); }