Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / September 2005

Tip: Looking for answers? Try searching our database.

__FILE__ macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lauch2 - 30 Sep 2005 04:24 GMT
VC7.1 changes the __FILE__.

In vc6, the __FILE__ returns the [full path name of the file]. However, in
vc7.1, the __FILE__ just returns the [.\file name]. It looks like vc7.1
changes a lot of things which makes it quite difficult to migrate vc6 code to
vc7.1. I am a little bit disappointed by vc7.1.

Any way, is there exited any macro to get the full path name during the
compilation?

thanks in advance,
lauch2
David Lowndes - 30 Sep 2005 11:14 GMT
>VC7.1 changes the __FILE__.
>
>In vc6, the __FILE__ returns the [full path name of the file]. However, in
>vc7.1, the __FILE__ just returns the [.\file name].

Strange, it shows the full path for me.

Do you have a way to reproduce this?

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq

lauch2 - 30 Sep 2005 11:34 GMT
> Do you have a way to reproduce this?
int _tmain(int argc, _TCHAR* argv[])
{
    puts(__FILE__);
    return 0;
}

FYI:
In Debug build, it returns the full path name
In Release build, it returns .\filename

Regards,
lauch2

> >VC7.1 changes the __FILE__.
> >
[quoted text clipped - 6 lines]
>
> Dave
David Lowndes - 30 Sep 2005 14:07 GMT
>In Debug build, it returns the full path name
>In Release build, it returns .\filename

So it does!

Set the /FC compiler switch:

"Without /FC, the diagnostic text would look similar to this
diagnostic text:

compiler_option_FC.cpp(5) : error C2143: syntax error : missing ';'
before '}'

With /FC, the diagnostic text would look similar to this diagnostic
text:

c:\test\compiler_option_FC.cpp(5) : error C2143: syntax error :
missing ';' before '}'

/FC is also needed if you want to see the full path of a file name
when using the __FILE__ macro. See Predefined Macros for more
information on __FILE__.
"

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.