|
From: Chris S. <CS...@Ai...> - 2003-10-03 02:21:47
|
Damian,=20
=20
Please could you also provide the code with the full path name - there =
may be some incorrect syntax there.=20
=20
Chris=20
-----Original Message-----
From: damian knight [mailto:kni...@ho...]
Sent: Friday, 3 October 2003 8:21 AM
To: Chris Sroka
Subject: RE: [Dev-C++] opening files
Chris
This is the code when a Game object is instantiated. the file =
"instructions.txt" is located in the same folder as the .cpp files. All =
I get when i run the program though is the "Data not found..." error =
messages that are in the else statement. I did try putting the full =
path name in the code with the same result, the "Data not found..." =
error message. The bizarre thing is, the code below works perfectly on =
my Win 98SE partition!
Game::Game()=20
{=20
char ch;=20
ifstream inFile;=20
inFile.open("instructions.txt");=20
if(!inFile.fail())=20
{=20
system("CLS");=20
while(!inFile.eof())=20
{=20
ch =3D inFile.get();=20
if(ch =3D=3D '@') // end of page=20
{=20
cout << endl;=20
system("PAUSE");=20
system("CLS");=20
}=20
else=20
cout << ch;=20
}=20
inFile.close();=20
}=20
else=20
{=20
cout << "Data file not found..." << endl;=20
cout << "Fatal error..." << endl;=20
cout << "Terminating program..." << endl;=20
system("PAUSE");=20
exit(1);=20
}=20
}=20
>From: "Chris Sroka"=20
>To: "damian knight" ,=20
>Subject: RE: [Dev-C++] opening files=20
>Date: Thu, 2 Oct 2003 05:39:33 +0100=20
>=20
>Damian,=20
>=20
>When you run DevC++ from the IDE (ie the development environment) and =
don't specify a file path when opening files, then DevC++ uses the =
default path, ie the location of your DevC++ program files, usually =
"C:\Program Files\Dev-C++\Bin" or similar. So this is where your =
application will look when trying to open a file.=20
>=20
>To get around this. either specify the full path of the files you are =
trying to open, or put the files in the same place as your DevC++ =
application. The first suggestion is the more elegant and efficient.=20
>=20
>Chris=20
>=20
>=20
>=20
>-----Original Message-----=20
>From: damian knight [mailto:kni...@ho...]=20
>Sent: Thursday, 2 October 2003 11:59 AM=20
>To: dev...@li...=20
>Subject: [Dev-C++] opening files=20
>=20
>=20
>=20
>=20
>=20
>=20
>=20
>Hi=20
>=20
>I am currently running Dev C++ v.4. I have XP home edition as my OS. =
When i compile and run my program, the files I am trying to read from =
are not being found. They are located in the same directory as my .cpp =
files and the program works at a different location running Win 2000!=20
>=20
>Any ideas?=20
>=20
>Damian=20
>=20
>=20
> _____=20
>=20
>Get less junk mail with ninemsn Premium. Upgrade now! =
------------------------------------------------------- This sf.net =
email is sponsored by:ThinkGeek Welcome to geek heaven. =
http://thinkgeek.com/sf _______________________________________________ =
Dev-cpp-users mailing list Dev...@li... TO =
UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm =
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20
>=20
_____ =20
Protect your inbox from harmful viruses with new ninemsn Premium. =
Upgrade now! <http://g.msn.com/8HMAENAU/2746??PS=3D> =20
|