C (264/274)

From:Jack York
Date:06 Oct 2000 at 18:55:58
Subject:Re: Reading a disk file

Hello Gregory

On 06-Oct-00, Gregory Roberts II wrote:

>> Now when I want to read it back in and put each name read
>> back into a list, I can't see which size to use in the fread
>> statement to get the proper length, since the lenght of each
>> entry varies. I can accomplish the reading and writing if
>> I write using structures but then the file isn't readable from
>> outside the program. I thought about putting some kind of
>> delimiter after each name before writing and then searching
>> for that when it is read in but that seems rather sloppy. Any
>> ideas on how to do this?

> Try fgets(). This will read a string until either a certain number of
> character is reached (so you don't overrun your buffer), or until the
> end-of-line.

Thanks Greg, that did the trick.

Jack