-void get_string(FILE *fp, char * str, int len)
- /* len include the room for the \0 */
- /* if len is too small, the string is truncated. */
-{
- char b;
- while (1)
- {
- fread(&b, 1, 1, fp);
- if (len > 0)
- {
- *(str++) = (len > 1 ? b : '\0');
- len--;
- }
- if (b == '\0')
- return;
- }
-}
-
-