@eniko not sure if it fits your needs, but if the file is a file, my policy is almost always to read the entire thing into memory and then split it by lines if that's how i wanted it formatted
@eniko and when i say "split it by lines" i usually mean make a bunch of { char *, length } strings that point into that one buffer without malloc'ing the individual lines, but again - depends on use case ^^