Data type is usually the most important thing to include -- how is fout declared? If it is an ofstream, you are using the default mode, which I believe means to truncate an existing file. I think you would need to use an fstream opened for read/write ("r+" in fopen-speak), perhaps even in binary mode as well.
http://www.dinkumware.com/htm_cpl/fstream.html#basic_filebuf::open
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Okay, I tried something from the link you posted, but I just got more confused :lol:
Yeah, me too.I'll post you what im using now:
filebuf iobuf;
iobuf.open("Character.xls",ios_base::in | ios_base::out);
\\ loads of input text
iobuf.close();
<< moderator edit: added [code][/code] tags >>:?:I'm still using the fout because the compiler tells me its necessary to input the data, but now the program wont return me anything, it leaves the file in blank, just like it was. So:
1. Do I have to create another way of calling a file output?
2. Do I need something else than #include ?I asked what type it was. You still haven't mentioned it. What isfout?
The page I linked to was to help explain the open modes.
Also, this
// loads of output text
doesn't tell me a whole lot about what you expect to accomplish.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
I didn't attach the header file because is way too messy, after all, Im noob , but I think this holds everything you need to detect a problem.
Without the header, I can't compile. ;)
ofstream fout;
// ...
filebuf iobuf;
iobuf.open("Character.xls",ios_base::in | ios_base::out);
I think you want fout to be anfstream (not an ofstream) and open it in the proper mode.
fstream fout;
// ...
fout.open("Character.xls",ios_base::in | ios_base::out);
And it really seems that you file is a tab-separated-values (.tsv) file, not an .xls.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Code in a header...! You have much to learn young grasshopper.
Sorry I haven't been that great of a help thus far. But have you considered outputting your data to a bland old .tsv file and then use Excel's wonderful import abilities to spruce things up on that end?
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314