First, the buffer might be full, in which case the library will flush it automatically.
Second, the library might be asked to read from the standard input stream. in that case, the library immediately flushes the output buffer without waiting for the buffer to become full.
The third occasion for flushing the buffer is when we explicitly say to do so.