Click to See Complete Forum and Search --> : C++ Preprocessor: What are '__FILE__' and '__LINE__'?


Yves M
February 13th, 2003, 01:04 PM
Q: What are '__FILE__' and '__LINE__'?

A: '__FILE__' and '__LINE__' are predefined macros and 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.

There are other preprocessor variables including:

'__DATE__' -> a string literal of the form "Mmm dd yyyy"
<br>
'__TIME__' -> a string literal of the form "hh:mm:ss"
<br>
'__TIMESTAMP__' -> a string literal of the form "Mmm dd yyyy hh:mm:ss"
<br>
'__FUNCTION__' -> a string literal which contains the function name (this is part of C99, the new C standard and not all C++ compilers support it)


FAQ contributed by: [Kevin Hall (http://www.codeguru.com/forum/member.php?u=85152)] [Axter (http://www.codeguru.com/forum/member.php?u=35679)]

<br></br>