[comp.sys.mac.programmer] MPW-C stdio buffering

wrp@krebs.acc.Virginia.EDU (Bill Pearson) (01/14/90)

	I would like to convert a program from unix to MPW-C.  I have managed
to get the program to work pretty well under the MPW shell, but am having
a terrible time with file buffering on stdin and stdout.  If I prompt for
a response without a '\n', e.g.:

	printf(" enter filename: ");
and follow it by:
	fgets(reply,sizeof(reply),stdin);

	reply contains:

	enter filename: filename-that-was-typed

This is awful.  If I put a "\n" after enter filename, everything is OK.
This happens regardless of whether I do a:

	setvbuf(stdout,NULL,_IONBF,0);
	setvbuf(stdin,NULL,_IONBF,0);

Is there any trick that I can do to resolve this problem, short of putting
lots of '\n''s in every prompt?

Bill Pearson
wrp@virginia.EDU