
June 10th, 2004, 11:15 PM
|
|
Registered User
|
|
Join Date: Jun 2004
Location: Vancouver + Hong Kong
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Possible to remove the line from txt file right after reading it?
Hi,
I'm trying to build a program that sort out informations from a ver large txt file, and i'm basically doing something like this:
Code:
ifstream x;
ofstream y;
string temp;
x.open ("file.txt", ios::in);
while (!x.eof())
{
getline (x, temp);
if ( x[1] == " xxxx ")
{
y.open("sorted.txt", ios::app);
y >> temp >> endl;
y.close();
}
}
But after reading for around 1/4 of a 400mb txt file, the program just terminated before the end of file. I suspect that it's have to do with the file pointer.
So is there a way for me to delete the line from the file right after reading it?
|