From: "Daniël Hörchner" Newsgroups: comp.os.msdos.djgpp Subject: scanf/gets bug? Date: Sun, 08 Nov 1998 18:26:54 +0100 Organization: MultiAccess Lines: 25 Message-ID: <3645D45E.8A5C98E5@usa.net> NNTP-Posting-Host: polka-eth1.news.big-orange.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: rumba.admin.big-orange.net 910549886 32532 172.22.0.80 (8 Nov 1998 18:31:26 GMT) X-Complaints-To: newsmaster AT admin DOT big-orange DOT net NNTP-Posting-Date: 8 Nov 1998 18:31:26 GMT X-Mailer: Mozilla 4.01 [en] (Win95; I) X-Priority: 3 (Normal) Cache-Post-Path: polka!unknown AT 141 DOT 130 DOT dialin DOT mxs DOT nl To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello fellow DJGPP-ers, I came across a weird problem with DJGPP (GCC 2.8.1). In the following program gets() should wait for input, but it doesn't. What's wrong? The strange thing is that if I insert a call to getch() between scanf() and gets(), getch() waits for input, but gets() still does not. With Turbo C++ 3.0 it works fine (i.e., gets() waits for input). Thanks in advance, Daniel #include int main(void) { int x; char string[10]; scanf("%d", &x); fflush(stdin); gets(string); puts("hello"); return 0; }