From: Weiqi Gao Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with while-loop Date: Sat, 04 Sep 1999 18:24:29 -0500 Organization: CRL Network Services Lines: 24 Message-ID: <37D1AA2D.F5108318@a.crl.com> References: <37D1958F DOT FEA86502 AT t-online DOT de> NNTP-Posting-Host: a116020.stl1.as.crl.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i586) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Michael Nöthe" wrote: > > I bought a book on learning C++ and along with it I got a copy of > the GNU-C++ Compiler V. 2.7.2.1 for DOS from DJGPP. > > In the book there was a sample program introducing encapsulated > while-loops. A turning line (\|/-) should be shown on the screen. > Now my problem is, the program doesn't seem to do anything ! > It compiles without any problems, but when I execute it, it shows > nothing on the screen. > After I finally use to stop the programm, only the last > charakter (e.g.: "\") is shown. Your problem is not with the while loop. It is with the way stdout buffers its output. To make your program work, you need to add a call to fflush(stdout); after each call to printf(). -- Weiqi Gao weiqigao AT a DOT crl DOT com