Replace this:
inStream >> next;
while (!inStream.eof()) //while loop not working
with this:
while (inStream >> next) //while loop working
{
and do this:
outStream.open(outfileName.c_str(), ios::app); //appends to the end of the file each time
only once, before the while loop. And drop the inStream >> next in the following:
inStream >> next;
}
return 0;
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
GORT!
Why is the outStream opened every time?
I may be wrong but I believe once is enough.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
So we can mark thisone as solved?
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
Don't use the >> operator. Use one of the get() or getline() functions instead.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396