🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: net.micro.atari16
4 messages
4 total messages Started by b. k. delaney Sat, 22 Mar 1986 17:37
Bug in MEGAMAX C ?
#242
Author: b. k. delaney
Date: Sat, 22 Mar 1986 17:37
20 lines
948 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. 

				ihnet!bryan
p.s. We tried calling the program a.tos, but that did not help either
Re: Bug in MEGAMAX C ?
#272
Author: Tim Smith
Date: Tue, 25 Mar 1986 21:16
8 lines
857 bytes
It sounds like stdout is buffered.  Try saying

	fflush( stdout );

before the getchar().
-- 

Tim Smith       sdcrdcf!ism780c!tim || ima!ism780!tim || ihnp4!cithep!tim
Re: Bug in MEGAMAX C ?
#270
Author: Jwahar R. Bammi
Date: Wed, 26 Mar 1986 07:26
32 lines
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
Re: Orphaned Response
#320
Author: m5
Date: Mon, 31 Mar 1986 21:15
7 lines
879 bytes
The function getchar() is designed to return characters from line-
edited input from the keyboard, in keeping with the implementation
of standard I/O everywhere else in the world.  If you want characters
as they are typed, use the low level BIOS routines.

Mike McNally			Megamax
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads