I am going through the C for Dummies tutorials and have run into a problem using fflush.
Code:
#include <stdio.h>
int main()
{
char c,d;
printf("Enter a key, blah blah blah:\n");
c=getchar();
fflush(stdin);
printf("Enter a different key, blah blah blah:\n");
d=getchar();
if(c=='G' || c=='g' && d=='0')
{
printf("**** AUTO DESTRUCT ACTIVATED ****\n");
printf("**** GOODBYE ****\n");
}
else
{
printf("Nice job moron.\n");
}
return (0);
}
A) When I use fflush, it compiles just fine, no errors.
But when the program runs, and I type e I get the following result:
Enter a key, blah blah blah:
At the prompt I can type a letter...I choose 'e', then hit return and it spits out the next three lines, end program.
e
Enter a different key, blah blah blah:
Nice job moron.
B) When I use fpurge the compiler returns an error that reads:
ld: Undefined symbols:
___gxx_personality_v0
Sorry for the lengthy description, can anyone help me out?
Bryan a.k.a. New Guy