hi people does anyone know why I won't get any output to the console I'm expecting the firsts econd and third thing I wrote to the file to be printed out
But when I run the program nothing gets printed to the screen any ideas?
<< sends something to the output stream. That stream will get flushed at some time in the future, and that's when the file will be written to. If you want to force it to be flushed, you can use http://www.cplusplus.com/reference/ostream/ostream/flush/
that worked great actually thanks Moschops,I wonder why you have to flush teh file for it to be written I thought it would be written once you do theFile << one;
I wonder why you have to flush teh file for it to be written I thought it would be written once you do theFile << one;
If you read the C++ documentation, you'll find that << doesn't write files. It puts something into the stream. That's what it does. The << operator doesn't write anything to a file. It's not what it does. You simply misunderstood what the << operator does. I expect that wherever you learned it from didn't fully explain it, probably to keep things simple.