C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Relative Filename Problem

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Tanuki
Guest





PostPosted: Sun Dec 28, 2003 3:50 pm    Post subject: Relative Filename Problem Reply with quote



Hi:

I have a problem regarding filenames in Visual C++.

I would like to read from files using relative filenames instead of
absolute filenames. I have tried using the following

fname = .\<data directory>>\<

I have no problem when executing from within the IDE (i.e. pressing
CTRL+F5) but when I run the executable (i.e. <prog.exe> ), the file
cannot be found.

When I tried to change it to
fname = ../<data directory>>/<
the executable can work but this time round, executing from the IDE
will render file not found problem.

I know this may be trivial to experts here but sincerely appreciate
any help. Thank you.
Back to top
Jack Klein
Guest





PostPosted: Sun Dec 28, 2003 3:58 pm    Post subject: Re: Relative Filename Problem Reply with quote



On 28 Dec 2003 07:50:10 -0800, [email]kochiam (AT) yahoo (DOT) com[/email] (Tanuki) wrote in
comp.lang.c++:

Quote:
Hi:

I have a problem regarding filenames in Visual C++.

Then you need to ask about it in a group that supports your
implementation, such as news:comp.os.ms-windows.win32.programmer or
one of Microsoft's support groups in the news:microsoft.public.vc.*
family.

Quote:
I would like to read from files using relative filenames instead of
absolute filenames. I have tried using the following

fname = .\<data directory>>\<
I have no problem when executing from within the IDE (i.e. pressing
CTRL+F5) but when I run the executable (i.e. cannot be found.

When I tried to change it to
fname = ../<data directory>>/< the executable can work but this time round, executing from the IDE
will render file not found problem.

I know this may be trivial to experts here but sincerely appreciate
any help. Thank you.

The C++ language defines file access functions that accept a C style
string for dealing with fstream and FILE * streams. It does not
specify the content of those strings, or how they are interpreted by
the implementation's file system.

The details of how Windows maps strings into paths and file names is a
Windows specific detail, not one specified by the language.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.