Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!eecae!cps3xx!usenet From: usenet@cps3xx.UUCP (Usenet file owner) Newsgroups: comp.os.minix Subject: putchar in MINIX 1.2 and 1.3 Keywords: Minix 1.2, 1.3, putchar() Message-ID: <2494@cps3xx.UUCP> Date: 13 Apr 89 18:27:26 GMT Expires: 28 Apr 89 04:00:00 GMT References: Reply-To: rattan@frith.egr.msu.edu () Followup-To: rattan@frith.egr.msu.edu Distribution: na Organization: Michigan State University Lines: 33 I am using MINIX to teach the OS course. I am having a problem with the 'putchar()' in the c-compiler of v1.3 (The same problem exists in v1.2). Here is a code segment #include main() { int c; while ((c = getchar()) != '\n') putchar(c); getchar(); } the execution of the above code: 12345 q !! buffer not flushed before second getchar() 12345$ The Unix version of the above is: 12345 12345q$ !! buffer flushed before second getchar() It seems that there is problem with flushing of the buffer. Is there a way out without redefining 'putchar()' in term of 'printf()' in include/stdio.h ? Does it require changes to fputc.c in library sources? The problem seems to be bugging the students and hence, help will be greatly appreciated. - ishwar rattan (rattan@frith.egr.msu.edu)