CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 1 of 1

Thread: C++ Preprocessor: What are '__FILE__' and '__LINE__'?

  1. #1
    Join Date
    Aug 2002

    C++ Preprocessor: What are '__FILE__' and '__LINE__'?

    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"

    • '__TIME__' -> a string literal of the form "hh:mm:ss"

    • '__TIMESTAMP__' -> a string literal of the form "Mmm dd yyyy hh:mm:ss"

    • '__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] [Axter]

    Last edited by Andreas Masur; July 23rd, 2005 at 01:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)