From: "Michael Ahumibe" Newsgroups: comp.os.msdos.djgpp Subject: fflush (in djgpp) Date: Sun, 8 Apr 2001 20:58:06 +0100 Organization: BT Internet Lines: 54 Message-ID: <9aqfuu$fnb$1@uranium.btinternet.com> NNTP-Posting-Host: host62-7-49-46.btinternet.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi I apologise in advance to those who saw this in comp.lang.c. It wasn't meant for that news group but was meant, for this one, but was posted in error. I'm having problems with the fflush command. Every time I use it, doesn't work. Ok, here's an example of me using the fflush command... /* Clearing stdin of extra characters. */ /* Using the fflush() function */ #include main() { int age; char name[20]; /* Prompt for user's age. */ puts("Enter your age."); scanf("%d", &age); /* Clear stdin of any extra characters. */ fflush(stdin); /* Now prompt for user's name. */ puts("Enter your first name."); scanf("%s", name); /* Display the data. */ printf("Your age is %d.\n", age); printf("Your name is %s.\n", name); return 0; } Output example... Enter your age. 20 years old (my input) Enter your first name. Your age is 20. Your name is years. Can someone tell me what's wrong? or if there is a work around. thanks Mike