[TriLUG] Linux C++ Programming Question

Wing D Lizard wingedlizard at nc.rr.com
Thu Sep 22 16:18:35 EDT 2005


man fflush

Randall Patrick Barlow wrote:

> I wrote a console based program under Windows, and I then compiled the 
> same code with g++ under Linux.  The program is supposed to output to 
> the screen the percentage done periodically, so the user has some idea 
> if the program will take minutes, hours, days, etc.  In Windows, this 
> works great.  However, in Linux, it doesn't seem to get written to the 
> screen every time I cout, as if there were some kind of buffer that 
> were filling up and waiting to get to a certain level before dumping 
> to the screen (under bash).  The line of code that writes to the 
> screen is something like:
>
> cout << '\r' << [code to determine percentage done] << "% complete";
>
> Any ideas why I don't see this all the time?  It does eventually come 
> out, but nothing until it's written several times.  I even have an 
> initial line that is supposed to write 0% done, and that never shows 
> up (but does in Windows).  It's no big deal, but it does bug me :)
>
> Thanks,
> Randy




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.4/109 - Release Date: 9/21/2005




More information about the TriLUG mailing list