#line [C++ Reference]
Keywords: preprocessor,line
Date: 2009-10-12T16:56:13-0700

[[#line]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## #line

Syntax:

        #line line_number "filename"

The #line command is simply used to change the value of the `__LINE__` and `__FILE__` variables. The filename is optional. The `__LINE__` and `__FILE__` variables represent the current file and which line is being read. The command

         #line 10 "main.cpp"

…changes the current line number to 10, and the current file to “main.cpp”.

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •