Date: Wed, 24 Apr 1996 08:57:38 +0200 (MET DST) From: "Christoph P. Kukulies" Subject: Re: Odd printf behaviour In-reply-to: To: orly AT abigail DOT eee DOT upd DOT edu DOT ph (Orlando Andico) Cc: gfedor AT lerc DOT nasa DOT gov, djgpp AT delorie DOT com Reply-to: Christoph Kukulies Message-id: <199604240657.IAA02595@gilberto.physik.rwth-aachen.de> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit > > On 23 Apr 1996, Gregory Fedor wrote: > > > I wrote some simple code that utilizes the gotoxy() and printf() > > statements to place text on the screen, ala: > > > > while(!done) > > { > > gotoxy(column, line); > > printf(" %... ", ...); fflush(stdout); or put a setvbuf(stdout,NULL,_IONBF,0); at the beginning of your file. (not sure if if works under djgpp, though). > > > > // update column > > // update line > > } > > > > When I run this type of code nothing appears on the screen. I can see > > the cursor jumping around, but nothing else. However, if I include a > > '\n' in the printf statement, things display fine, *or* as soon as I > > printf with a '\n' outside the loop, then **all** the text gets > > displayed. It's almost as if it's being buffered, and isn't displayed > > until a '\n' comes along. > > > > I'm stumped, anyone got a hint? > > > > Thanks > > Gregory > > > > ------------------------------------------------------------------------------- > > Gregory A. Fedor ADF Inc. / NASA Lewis Research Center > > Computer Engineer Microgravity Experiments > > work: gfedor AT lerc DOT nasa DOT gov http://sven.lerc.nasa.gov/~gfedor (216)977-1247 > > personal: gfedor AT en DOT com http://www.en.com/users/gfedor > > > > if i remember the bad old days of turbo c well enough, printf() which is > a stream io command and gotoxy() which is a console io command don't mix, > so the things you see are probably just a fluke. also, djgpp buffers > stdio with a 4k buffer (i think) which adds more complexity. i believe > what you should do is use curses (there's one for djgpp) and avoid the > nonportability of the turbo c conio.h functions. > > > --Chris Christoph P. U. Kukulies kuku AT gil DOT physik DOT rwth-aachen DOT de