www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/27/07:45:41

From: an096 AT yfn DOT ysu DOT edu (David A. Scott)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Strange DJGPP bug
Date: 27 Sep 1998 11:40:05 GMT
Organization: St. Elizabeth Hospital, Youngstown, OH
Lines: 40
Message-ID: <6ul86l$dot$1@news.ysu.edu>
References: <slrn70rpos DOT 5bh DOT user AT ts001d22 DOT cin-oh DOT concentric DOT net>
Reply-To: an096 AT yfn DOT ysu DOT edu (David A. Scott)
NNTP-Posting-Host: yfn2.ysu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In a previous article, user AT ts001d22 DOT cin-oh DOT concentric DOT net (Test User) says:

>Here's a short C program:
>
>#include <stdio.h>
>
>int main()
>{
>	char buffer[256];
>
>	printf("Input: ");
       you need a \n at end of line above to make it do the
  actaul printf. I think DJGPP is doing it correctly!!
>	fgets(buffer, 255, stdin);
>	printf("\nYou typed %s\n");
>}
>
>
>When compiled with the Linux version of GCC, this program
>prints an Input: prompt. When the user types something and
>presses ENTER, it then prints the string the user typed,
>in the form of "\nYou typed %s\n", where \n is a newline and
>%s is the string the user typed, including the trailing newline. 
>
>When compiled with DJGPP, the program just sits there until
>the user types something and presses ENTER. Then, the
>program spews out the Input: prompt and the string the
>user typed at the same time. For some reason, it executes
>fgets() first, and then executes both printf's together. You
>can't get it to print the prompt first, then call fgets(),
>and then print the results. You can substitute fgets() for
>your own elaborate loop system. You'll get the same result.
>
>

-- 
http://cryptography.org/cgi-bin/crypto.cgi/Misc/scott19u.zip
for the version with a real key of voer one million bytes.
 also scott16u.zip and scott4u.zip

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019