This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Flushing output before \n
- To: help-gcc at gnu dot org
- Subject: Flushing output before \n
- From: Michel Ducharme <ducharme at saturne dot uqah dot uquebec dot ca>
- Date: Wed, 27 Oct 1999 12:54:36 -0400 (EDT)
- Reply-To: Michel Ducharme <ducharme at saturne dot uqah dot uquebec dot ca>
Hello,
I am having trouble in flushing a line of text before a new
line character (\n) is output.
For example, I have :
cout << "Reading file...";
ReadFile();
cout << "\b\b\b - " << n << " records.\n";
The text from the first "cout" is not output until the second
"cout" is executed, because the first "cout" does not terminate
the line with a new line (\n) character.
I would like the first "cout" to be output when executed so
that is would be visible while the "ReadFile()" operation is
taking place.
I have tried using "system ("stty raw -echo")" before the first
"cout" and "system ("stty -raw echo")" after the last one, as
well as some other parameters of the "stty" command, but none
of these did achieve the desired result; the output of the first
"cout" instruction is still only seen after the new line character
is output by the second "cout".
Has anyone encountered this problem and has found a solution?
Sincerely,
Michel Ducharme.
___________________________________________________________________________
| ______ | |
| / / / / Michel Ducharme | Service de l'informatique |
| /_/_/ / Analyste en informatique | Université du Québec à Hull |
| /_/ (administrateur du réseau Sun) | 101, rue St-Jean Bosco |
| Tel.: (819) 595-3900 poste 1-1615 | Hull (Québec) J8Y 3G5 |
| FAX: (819) 773-1699 | Canada |
| Courrier électronique : Michel_Ducharme@UQAH.UQuebec.CA |
| Site Web du réseau Sun : http://w3.UQAH.UQuebec.CA |
|___________________________________________________________________________|