|
-
January 28th, 2003, 03:58 AM
#1
Bug in FSTREAM
I'm creating an instance of the IFSTREAM class (ifstream myFile). I'm able to open and read from the file the object is connected to. However after closing the object and then trying to Open again I promptly get an error.
My code looks something like this:
===
ifstream inFile;
inFile.open("e:\\Test.exe", ios::binary);
if (!inFile)
{cout << "File Open Error - Read" << endl; return 0;}
.
.
.
inFile.close();
inFile.open("e:\\Test2.exe", ios::binary);
if (!inFile)
{cout << "File Open Error - Read2" << endl; return 0;}
===
The error occurs for the second if (!inFile). Is this a bug within Visual C++'s implementation of ifstream? When i alter the ifstream object to a pointer (ie. ifstream *inFile) and apply new/delete before the next open all is fine. Why??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|