 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tanuki Guest
|
Posted: Sun Dec 28, 2003 3:50 pm Post subject: Relative Filename Problem |
|
|
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
|
Posted: Sun Dec 28, 2003 3:58 pm Post subject: Re: Relative Filename Problem |
|
|
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 |
|
 |
|
|
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
|
|