Try fgets(chars *s, int n, FILE *stream)... the n is the number of chars to read.
In general, whereis the console I/O functions seem to not take integer arguments specifying buffer length, the file-based equivlants typically do. You can use the file based ones by specifying stdin / stdout.
You may also be intrested in the strn family of functions, which are identical to the str functions ( i.e. strncat instead of strcat) except that they take an integer argument too, which can prevent buffer overflows caused by improperly terminated strings.
Regards
Meredith Shaebanyan
|