__FILE__

LuckyLucks
LuckyLucks used Ask the Experts™
on
Hi

__FILE__ and __LINE__ are in which C++ header that I need to include in order to use them?

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
evilrixSenior Software Engineer (Avast)
Commented:
They are not defined in any header, you just use them.
Top Expert 2016
Commented:
to add to above comment:

the macros __FILE__ and __LINE__ were provided by the precompiler and expand to the current source file name and line number.

for vc compiler you may see more at https://msdn.microsoft.com/en-us/library/b0084kay.aspx

__FILE__ and __LINE__ could be used for some error message to report some dissent detected by the program. For example,

 std::cerr << "Internal error: negative string length " << len << " at " << __FILE__ << ", line " << __LINE__ "\n";

Open in new window


Sara
evilrixSenior Software Engineer (Avast)

Commented:
LuckyLucks, you realise that my comment, the first one posted, actually answered your question, right? At best, Sara has just provided additional information to support my answer.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial