I used the fflush() in Linux GCC but it did not work. Are there any alternatives for that function? Here is my code:
#include
void main()
{
The behavior of fflush is not defined for input streams (online 2011 standard):
7.21.5.2 Thefflushfunction
Synopsis
1Description#includeint fflush(FILE *stream);
2 If stream points to an output stream or an update stream in which the most recent operation was not input, thefflushfunction causes any unwritten data for that stream to be delivered to the host environment to be written to the file; otherwise, the behavior is undefined.
3 Ifstreamis a null pointer, thefflushfunction performs this flushing action on all streams for which the behavior is defined above.
Returns
4 Thefflushfunction sets the error indicator for the stream and returns EOF if a write error occurs, otherwise it returns zero.