DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    john_trivolta Guest

    __FILE__ Predefined Macro


    when I use it in my program to display file name it displays complete path

    like

    C:\Windows\Desktop\Project\FuzzyLogic\Fuzzy.cpp

    I'm willing to display "Fuzzy.cpp" and not the complete path. Any idea?


  2. #2
    ralph Guest

    Re: __FILE__ Predefined Macro


    "john_trivolta" <john_trivolta@planetaccess.com> wrote:
    >
    >when I use it in my program to display file name it displays complete path
    >
    >like
    >
    >C:\Windows\Desktop\Project\FuzzyLogic\Fuzzy.cpp
    >
    >I'm willing to display "Fuzzy.cpp" and not the complete path. Any idea?
    >


    If you mean by "display" you just want to print out the file name you can
    do something like this...

    char* pc = strrchr(__FILE__, '\\');
    printf("This file is %s\n", pc + 1);
    string sFile(pc + 1);
    cout << sFile << endl;

    If you want to change the behavior of the predefined macro then you are probably
    out of luck.

  3. #3
    john_trivolta Guest

    Re: __FILE__ Predefined Macro


    Thank you Ralph ! I was looking for the display purpose only.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links