http://hi.baidu.com/419836321/blog/item/fcf5ceec484681cfb31cb1f7.html
__FILE__ is used in C to indicate the filename of the source file in which the statement is written, for example (test.c) :
GCC compiler generates a.out. After execution, the output is: test.c Compiling results under Windows VC6.0 are as follows: C :\ Documents and Settings \ Administrator \ Desktop \ Test.c ——————————————————————————————————————————————————————————————————– ————————————————————————– __LINE__ in C is used to indicate the position of the statement in the source file. Examples are as follows:
main() { The program is compiled in Linux with GCC, in Windows VC6.0 under the compilation can pass, the execution results are: 7 8 9 __LINE__ can also be reset with the #line statement, for example:
# line 200 After compilation and execution, the output is: 202 203 204 ——————————————————————————————————————————————————————————————————– ————————————————————————— GCC also supports __func__, which indicates the function, but this keyword is not supported in VC 6.0 under Windows, for example:
The output result after compilation is this is print by function main Note # “line”, “__LINE__”, “a __FILE__” and “__func__” are case sensitive. |
Read More:
- Java 8 Stream – Read a file line by line
- Three ways of single line and multi line comment in Python
- Error: unrecognized command line option “-std=c++11”, to solve the problem that ubuntu does not support c++11
- Command line is too long. Shorten command line for QuestionnaireApplication or also for Spring Boot
- Let’s get started with latex 05, line feed, paragraph feed, page feed, first line indent, etc
- c1: Commend line error D8021 :invalid numeric argment ‘/Wno-cpp’
- Solution of command line window flashback when visual studio runs C + + program
- cenos Upgrade g++ gcc(cc1plus: error: unrecognized command line option “-std=c++11”)
- Error running ‘application’: command line is too long. Short command line for application
- c# Newtonsoft.Json.JsonReaderException: ‘Error reading JArray from JsonReader. Path ‘‘, line 0
- Today’s file “/usr/bin/yum”, line 30 problems
- Use Python to insert the specified content in the specified line of the specified file
- File “manage.py“, line 17 ) from exc ^ SyntaxError: invalid syntax
- Batch modification of file names on MAC Linux rename command line
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- Maven of springboot project pom.xml Unknown error in the first line of the file
- Error in Maven POM file: multiple annotations found at this line solution
- How to Fix Parser rerror: error tokenizing data. C error: expected 2 fields in line 53, saw 3
- Error c2137 of C language: empty character constant (Fixed)