Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with file size limit using ostream.

Status
Not open for further replies.

SWCroaker

Programmer
May 24, 2002
2
US
I'm just getting into using the ostream to write text files. For some reason, I keep running into some sort of maximum file size. My code initially worked fine when I was creating a smaller output file. As it's grown in size, my program now aborts before all of the output is written to the file. If I shorten the size of the initial lines (remove blank space, replace spaces by tabs, ect), I can get a few more characters to show up at the end of the file before the abort takes place.

My code looks something like this:

ofstream os;

os.open("file.txt");

start program loop...
os.write(buffer, strlen(buffer);
end program loop...

os.close();

Am I overlooking something? I've tried playing with the os.flush command, and it seems not to be helping my problem. The visual C++ documentation is very confusing on this item, as it seems to be a very generic class.

Thanks much for your help.
 
I found the problem. Program was abending on an fprintf farther down in the code. I was seeing the print location change because my ostream was buffered, and would only write to the file every so often....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top