Index:
[thread]
[date]
[subject]
[author]
From: Michael Abernethy <mna@duke.edu>
To :
Date: Sun, 14 Feb 1999 18:16:27 -0500
Re: Outputting to a file
We found we were passing around the output file by value rather than by
reference. Once we started passing it by reference, output started
showing up.
> > We are declaring a ofstream called output which is set to our filename
> > using "output.open(filename.c_str())". But how do we actually write to the
> > file? We tried using "output << "blah blah" << "\n"; But nothing is
> > being written to the file. Suggestions? Thanks.
>
> The only thing that comes to mind is, are you closing
> the file when you're done with it? That might be causing
> the problem (maybe...). One other thing, using endl
> instead of "\n" might be something you should be doing;
> endl flushes the output buffer, causing everything currently
> in the buffer to be written to the file. I don't know for
> sure if "\n" will do this with the << operator... It
> might, but it also might not, and if it doesn't, that
> could be a reason why you're never seeing anything.
>
> Good luck.
>
> Tim
>
>
Mike Abernethy
www.duke.edu/~mna
IBM Club Cyberblue - www.cybrblu.ibm.com
Index:
[thread]
[date]
[subject]
[author]