Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!jarthur!elroy.jpl.nasa.gov!ncar!gatech!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: printf and scanf in IBMC on IBM 3090 Message-ID: <15080@smoke.brl.mil> Date: 5 Feb 91 19:26:43 GMT References: <1991Feb4.234251.14836@ms.uky.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 15 In article <1991Feb4.234251.14836@ms.uky.edu> ghot@s.ms.uky.edu (Allan Adler) writes: >In order to get the program to work correctly, the line >printf("Please type your name: "); >has to be replaced by >printf("Please type your name: \n"); >I would never have predicted this based on my previous experience with C >and my readings. Can someone tell me if this behavior is consistent with >the ANSI standard ? It's not just IBM; many systems will line-buffer output to an interactive device, and the C standard encourages this. What you SHOULD have done is to insert fflush(stdout); before trying to read interactive input, to ensure that the previous prompt has been flushed out where the user can see it.