Date: Sat, 20 Dec 1997 10:34:51 -0800 (PST) Message-Id: <199712201834.KAA17115@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Adam Young , djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: Parallel Port and printf Precedence: bulk At 11:16 12/19/1997 -0600, Adam Young wrote: >Hello, > >I am developing a program that uses the parallel >port to read a 4-bit BCD number and return the >decimal value. I am accomplishing this by constantly >scanning the port and checking for the strobe (DV) >to go high. Once it goes high, the 4-bit word is >sent to "conv" to be converted to the corresponding >decimal value and printed to the screen. This is the >problem. The "printf" marked with the ???? is needed >for the numbers to be printed out "real time". If >I do not have the "printf ("\n");" statement, the >program only writes to the screen AFTER I hit control-c >to stop the program. I am using DJGPP and RHIDE to >develop this program. > >What I want is to print the data to the screen (and, >later to be logged in a file) in a row (ie. "123456") >instead of on a new line each time. I am sure this >is not a problem with DJGPP or RHIDE but a simple >"error" that I am making. Any help is appreciated. >Thanks in advance! This happens because the stdio stream is line-buffered. The simplest way to fix it is probably to replace your `printf("\n");' with `fflush(stdout);'. Also see FAQ section 9.4. Nate Eldredge eldredge AT ap DOT net