i dont understand what the function "flush" does
please answer
and one more,
is there a way that we output a set of data
only after a certain while in program execution
without storing it in a file and again
printing it after reading from that file
eg....
i declared a variable 'va'
in c++ code ..the value of va changes based upon
the input given by user which is done many times in program
and i like to print the value of va many times in program
but,only after the user is satisfies with his number of inputs
so i need to output all the values va all at a time at the only at the end
tnvkrishna 0 Light Poster
Recommended Answers
Jump to Post>but using cout or any object of ofstream also makes the data to be outputted
You're mixing things up. Any object derived from ostream contains a buffer. It's this buffer that "makes the data to be outputted", and when it sends characters from the buffer to the destination (the destination …
Jump to Post>then is it not possible to display output without using 'flush'
What in the world are you talking about? The only way to send output to the destination is to flush the buffer, and the buffer gets flushed automatically according to certain rules. You only need to call the flush …
Jump to Post>tell me the other cases
It depends on the stream. In the case of cout, you can expect it to be flushed when the program ends.>then buffer should not get flushed until "saturated "
That's a reasonable assumption.>and what if i increase the capacity of buffer …
All 10 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
tnvkrishna 0 Light Poster
Narue 5,707 Bad Cop Team Colleague
tnvkrishna 0 Light Poster
vijayan121 1,152 Posting Virtuoso
tnvkrishna 0 Light Poster
Narue 5,707 Bad Cop Team Colleague
tnvkrishna 0 Light Poster
Narue 5,707 Bad Cop Team Colleague
vijayan121 1,152 Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.