On 28 Dec 2003 07:50:10 -0800,
ko*****@yahoo.com (Tanuki) wrote in
comp.lang.c++:
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.
I would like to read from files using relative filenames instead of
absolute filenames. I have tried using the following
fname = .\\<data directory>>\\<<file1>>
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>>/<<file1>>
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