954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Not reading in entire file.

I just can't figure out why this program isn't reading in the entire file. It will only read in the second line, nothing else.

Here are my read and write functions:

bool Write(string Text,string FileName){
fstream Write;
Write.open(FileName.c_str(),ios::out|ios::app);
if(!Write){
cout<<"Error in opening file";
return 0;
}
Write<

SquirrelProdigy
Newbie Poster
24 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

You have:
while(!Read.eof()) Read.getline(buffer,300);
cout<

Chainsaw
Posting Pro in Training
436 posts since Jun 2004
Reputation Points: 36
Solved Threads: 11
 

Thanks a bunch, that fixed it. I didn't realize that it was replacing buffers contents everytime it read in a second line.

SquirrelProdigy
Newbie Poster
24 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You