Re: help with c++ program
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Sun, 15 Oct 2006 18:17:55 -0700
marsze@xxxxxxxxx wrote:
now i want to put the configuration file in the current directory.
this works fine in debug, but gives an error when executing without
debugging (I checked the file is in the debug and release directories).
private: void ReadCfg(void) {
string fileline;
char* Adir;
const char *fname = "\\MipMenu.cfg";
// Get the current working directory:
if( (Adir = _getcwd( NULL, 0 )) == NULL )
perror( "_getcwd error" );
strcat(Adir, fname);
ifstream CfgFile (Adir); //C:\\demand\\MipMenu\\
getline(CfgFile, fileline);
processline(fileline, 1) ;
....
char * Adir = _getcwd( NULL, 0 );
string filename = Adir;
free( Adir );
filename += "\\MipMenu.cfg";
ifstream CfgFile( filename.c_str() );
--
- Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
.
- Follow-Ups:
- Re: help with c++ program
- From: marsze
- Re: help with c++ program
- References:
- help with c++ program
- From: marsze
- help with c++ program
- Prev by Date: Re: string conversion (char[50] -> CString)
- Next by Date: Re: string conversion (char[50] -> CString)
- Previous by thread: Re: help with c++ program
- Next by thread: Re: help with c++ program
- Index(es):
Relevant Pages
|