[NTLUG:Discuss] fflush dosn't work
Daniel Hauck
xdesign at hotmail.com
Sun Jul 14 22:57:57 CDT 2002
Ah yes, I've had this problem in the past. See, what you need to use here
is another function.
pplunger();
There are times when the "IO stream" get cluttered with unused and
over-processed data causing a build-up on the data bus. The use of
pplunger() is discouraged, but when all else fails, the old standby is your
only option.
----- Original Message -----
From: "Geremy L. Hamlett" <ghamlett at swbell.net>
To: "North Texas Linux Users Group" <discuss at ntlug.org>
Sent: Sunday, July 14, 2002 22:34
Subject: [NTLUG:Discuss] fflush dosn't work
> I am having a problem with some .c code. Specificlly w/ the fflush syntax.
>
> Here is some sample code:
>
> #include <stdio.h>
>
> int main(void){
>
> char ch = 'N';
>
> while (ch != 'y'){
> printf("Enter a letter:");
> fflush(stdin);
> scanf("%c", &ch);
> }
>
> return (0);
> }
>
>
> Basicly what happens is it enters the loop, and prompts to enter a letter.
> Then after the input the loop checks the true/false condition of the loop.
>
> When you type a letter and then enter, it then checks. The fflush command
> is suposed to flush the input and remove the \r token, But it dosn't.
>
> after compiling w/ gcc and run it. The fflush dosn't seam to remove any
> thing.
>
> What Do I need to do to utilize fflush?
>
> Thanks for your help,
> --
> Geremy L. Hamlett
>
> http://omega.uta.edu/~glh6688
> "All Your Base are Belong to Us"
>
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
More information about the Discuss
mailing list