On 6 June 2011 20:07, Džen <yvl...@gmail.com> wrote: > I wonder, which method would need more cpu time? I suppose that when > using delimiters there isn't a easier way than using fgetc(), reading > through the whole data stream. Hard-coded field lengths would be faster > if the fields contain a lot of characters I guess.
Again, it's about the use case. For small fields you probably don't have to worry about reading inefficiencies, so use delimiters. For large fields use fixed-length or length-prefixed, for the reasons I mentioned. These two approaches are both easy to write, one is just faster to seek to the nth item, and the other is more compact, respectively. cls