Then I have no idea, it works fine for me. Try using fgets instead of gets and see how that works.
Code:
/* Little example */
#include <stdio.h>
int main(void)
{
char line[10];
if (fgets(line, sizeof (line), stdin) != NULL)
puts("Woohoo! It works!");
return 0;
}
Or if that doesn't work, you can use scanf.
Code:
/* Little example */
#include <stdio.h>
int main(void)
{
char line[10];
if (scanf("%9s", line) == 1)
{
int c;
if ((c = getc(stdin)) != '\n' && c != EOF)
ungetc(c, stdin);
puts("Woohoo! It works!");
}
return 0;
}
Or write your own if you really need to.