If you don't need to store the entire string then you can just read it from input a character at a time. A lot of utilities are based around this kind of loop:

Code:

while ((c=getchar())!=EOF)
{
//...do something
}

which reads characters from stdin into c (defined as int) and terminates at the end of file, so pipe semantics can be used, and if your OS is Unix and you're entering data from the keyboard you can press Ctrl-D to stop (assuming of course Ctrl-D is setup to send EOF, which it normally is).

May be the following code will also help, but always make use that this structure is the last variable to be declared and the string is the last member of the structure, or else there is a danger of overwriting values of other memory locations