Using #line directive

A

AA

Hi,
I have a C++ project in DOT NET. I am using the __FILE__ and __LINE__
to print the current file and line number. I do not want the file anem
with the full path to be printed. So I used the #line directive.

Code:
#line 3 "11.cpp"

Still the full file name along with the name (11.c) gets printed. If I
change 11.c above and type something else, say trial.cpp, the full file
path along with trial.cpp gets printed. How can I just get the file
name printed using __FILE__?

Regards,
AA
 
M

Michael Nemtsev

Hello AA,

How do u print the current file?

A> Hi,
A> I have a C++ project in DOT NET. I am using the __FILE__ and
A> __LINE__
A> to print the current file and line number. I do not want the file
A> anem
A> with the full path to be printed. So I used the #line directive.
A>
A>
Code:
A> 
A> #line 3 "11.cpp"
A> 
A>
A>
A> Still the full file name along with the name (11.c) gets printed. If
A> I change 11.c above and type something else, say trial.cpp, the full
A> file path along with trial.cpp gets printed. How can I just get the
A> file name printed using __FILE__?
A>
A> Regards,
A> AA
---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top