Article View: net.micro.atari16
Article #270Re: Bug in MEGAMAX C ?
From: Jwahar R. Bammi
Date: Wed, 26 Mar 1986 07:26
Date: Wed, 26 Mar 1986 07:26
32 lines
1457 bytes
1457 bytes
>
> I was over at a friends house who just got the MEGAMAX "C"
> compiler for his 520ST. There seems to be a bug with the
> printf function. For example:
>
> #include <stdio.h>
> main()
> {
> int c;
>
> printf("Hello world\n");
> printf("Enter a Char:");
> c = getchar();
> }
>
> Does not Work until you put a "\n" in the second
> printf statement.
That is not a bug. Printf write to stdout which is a bufferwed stream.
So if you want the prompt to appear before the getchar() you will have
to flush the stream something like
printf("Enter a Char:");
fflush(stdout);
c = getchar();
I tried it just now, and it works.
--
Jwahar R. Bammi
Usenet: .....!decvax!cwruecmp!bammi
CSnet: bammi@case
Arpa: bammi%case@csnet-relay
CompuServe: 71515,155
Technical Details
Message-ID:
<1449@cwruecmp.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!cwruecmp!bammiReferences:
<398@ihnet.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site cwruecmp.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!cwruecmp!bammi From: bammi@cwruecmp.UUCP (Jwahar R. Bammi) Newsgroups: net.micro.atari16 Subject: Re: Bug in MEGAMAX C ? Message-ID: <1449@cwruecmp.UUCP> Date: Wed, 26-Mar-86 02:26:46 EST Article-I.D.: cwruecmp.1449 Posted: Wed Mar 26 02:26:46 1986 Date-Received: Thu, 27-Mar-86 07:25:53 EST References: <398@ihnet.UUCP> Distribution: net Organization: CWRU Dept. Computer Eng., Cleveland, OH Lines: 32