Groups | Blog | Home
all groups > dotnet faqs > november 2006 >

dotnet faqs : Using #line directive


AA
11/29/2006 9:33:11 PM
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"

[/code]

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
Michael Nemtsev
12/1/2006 12:00:00 AM
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> [/code]
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

AddThis Social Bookmark Button