www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Setting folders

reply "Steve" <steve hmtk.com> writes:
I'm having some difficulty getting file i/o to work to my satisfaction.

When my program starts up it has to load a few data files. Sometimes when a
user starts the program, rather then the program loading the files from the
same directory that it resides in, it ends up going to the last folder the
user accessed. The program then reports an error as it could not find the
files!

In a similar manner, if the user saves a file all subsequent loads and saves
will begin at the directory just accessed!

Please help, I'm sure there is something very simple that I am missing.

Steve De Chellis
www.hmtk.com
Jan 16 2004
parent "Bruce Dodson" <bruce_dodson_except_this_part hotmail.com> writes:
For your first question, use GetModuleFilename to figure out
where your program is.

For your second question, use the lpstrInitialDir field in
your OPENFILENAME structure.



"Steve" <steve hmtk.com> wrote in message
news:bua4ou$2o7m$1 digitaldaemon.com...
 I'm having some difficulty getting file i/o to work to my
satisfaction.
 When my program starts up it has to load a few data files.
Sometimes when a
 user starts the program, rather then the program loading
the files from the
 same directory that it resides in, it ends up going to the
last folder the
 user accessed. The program then reports an error as it
could not find the
 files!

 In a similar manner, if the user saves a file all
subsequent loads and saves
 will begin at the directory just accessed!

 Please help, I'm sure there is something very simple that
I am missing.
 Steve De Chellis
 www.hmtk.com
Jan 16 2004