Using #line directive

Discussion in 'C++' started by AA, Nov 30, 2006.

  1. AA

    AA Guest

    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
    AA, Nov 30, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M. Uli Kusterer

    Equivalent to C's #line directive?

    M. Uli Kusterer, Sep 20, 2004, in forum: Java
    Replies:
    5
    Views:
    478
    Daniel Bonniot
    Sep 21, 2004
  2. Mantorok Redgormor

    line directive

    Mantorok Redgormor, Nov 16, 2003, in forum: C Programming
    Replies:
    2
    Views:
    317
    Sidney Cadot
    Nov 16, 2003
  3. AA

    Using #line directive

    AA, Nov 30, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    543
    Michael Nemtsev
    Dec 1, 2006
  4. Pawel

    #line directive makes gdb crazy ?

    Pawel, Jan 12, 2007, in forum: C Programming
    Replies:
    3
    Views:
    607
    Kenneth Brody
    Jan 15, 2007
  5. Alf P. Steinbach

    Re: Using #line directive

    Alf P. Steinbach, Nov 30, 2006, in forum: C++
    Replies:
    1
    Views:
    322
    Richard Heathfield
    Nov 30, 2006
Loading...

Share This Page