|
From: Ioannis V. <no...@ho...> - 2002-06-10 02:19:25
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of rchavez > Sent: Monday, June 10, 2002 4:59 AM > To: Nancy Alvarez > Cc: dev...@li... > Subject: Re: [Dev-C++] no read file > > I ran into a similar problem using files. In my case I > didn't know that > DevC++ does not default to the directory where the executable > file is stored > so my files were not found. Well i think it does. Did you ran it separately or from within the IDE? > One fix was to explicitly set the directory path along with > the file name. > For example, if you wanted the file prova2.dat to be read out of the > directory Dev-C++/datafiles on a PC use > > "C:/Dev-C++/datafiles/prova2.dat" in f_in.open(). > > In microsoft operating systems the directory path is > specified with '\' but > your code will be more portable if you use forward slash '/' instead. This kind of thing cannot be portable. It depends on the OS and the compiler. GCC follows the UNIX style which is /. > > There is probably a way to set the default directory path in > your program > and there is also a way to specify the directory where the > executable code > is stored but I don't know how. Can someone else help with this? I am not using Dev-C++ but the same compiler (MINGW) and when i ran the program by its own, it looks for files in its directory by default. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |