Answer:

There are number of useful predefined macros which are part of the C/C++ standard. During preprocessing, they are replaced respectively by a constant string holding the current file name and by a integer representing the current line number:


__FILE__ Source file name (string) format "test.c"
__LINE__ Current source line number (integer)
__DATE__ Date compiled (string)format such as "Jan 15 2010"
__TIME__ Time compiled (string) format "11:01:01"
__TIMESTAMP__ Compile date/time format






Answers and Comments


User Avatar
Written by CodeGuru


BTW, for C# you can use StackTrace and StackFrame objects from the System.Diagnostics namespace with functions like GetFileLineNumber(), GetFileColumnNumber(), and many others


Saved Stories

Sponsored Categories