View Single Post
  #2 (permalink)  
Old October 1st, 2003, 06:59 PM
merediths merediths is offline
Authorized User
 
Join Date: Jul 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths
Default

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

Reply With Quote