> Now I am near a solution, something like this: Well, this isn't a C language user group so I'll be brief. Here's the outline of how I would do it.
Read entire file into memory Add a terminating NUL (because sometimes text files don't have an ending NL) Walk through the buffer char by char, saving pointers to starts of lines in an array and changing CR and NL to NUL (Since you don't know how many lines there will be extend the array with realloc(3) whenever you run out of pointers) You end up with a buffer containing the contents of the file as a bunch of NUL terminated strings, and an array of pointers to the lines. Storage cost: (size of file + 1) chars + (number of lines) char pointers + int to track pointer array size + int to store number of lines. Time cost: 2 passes through chars. Ken _______________________________________________ Freedos-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freedos-user
