BUT i noticed something wierd with another example. See this :
Code:
#include <stdio.h>
int main()
{
char x[BUFSIZ];
char str[BUFSIZ];
scanf("%s", &x);
fgets(str , sizeof(str), stdin);
printf("%s , %s", x , str);
system("PAUSE");
return 0;
}
compile\run it and enter any text. fgets() now will display the same text again !? does it mean that scanf() left the whole string in stdin? it should not leave what it can read , i told it to read a string , so why did it leave the whole string in the stream?? is this an exception or what?