Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flushing the Buffer

Status
Not open for further replies.

WarrenB

Programmer
Feb 7, 2001
38
GB
I was told when using cout the output is buffered. Does anybody know how I would go about flushing the buffer? Warren Brown
wazzer@btinternet.com
 
This is from the unix man page, but should be relevant...
Also, cerr is not buffered, just a note...

Standard I/O Functions fflush(3S)



NAME
fflush - flush a stream

SYNOPSIS
#include <stdio.h>

int fflush(FILE *stream);

DESCRIPTION
If stream points to an output stream or an update stream in
which the most recent operation was not input, fflush()
causes any unwritten data for that stream to be written to
the file, and the st_ctime and st_mtime fields of the under-
lying file are marked for update.

If stream is a null pointer, fflush() performs this flushing


Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Any ideas how to use this with a cout statement? Warren Brown
wazzer@btinternet.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top