You might try this:

char string[], c;
int i = 0;

while((c=getc(stdin)) != NULL)
{
string[i] = c;
i++;
}