Hi,
I often use C for data handling, with the data being sent back and forth from someone else's parent program (so I rarely write my own read/write functions). I have to update what I consider an error-prone way of scanning and parsing a given file (known format).
I've gone through a number of posts in this forum on scanning/parsing text files with C functions. Usually, a newbie posts some first-try, and then others suggest good and not so good changes to the initial code. Sometimes, the low-level char-by-char manipulation seems to be one of the less error-prone ways of doing it.
I'd like to tackle this from another angle: has anyone come across well-written published C code that scans/parses and that has prompted one to say: "Now, that's the way to do it! Code to emulate for a newbie!". What I mean by 'published' is that it's actually found in a distributed program. Of course, anything open source GPL (most of Linux) would be appropriate as an example since the source code is accessible.
I often use C for data handling, with the data being sent back and forth from someone else's parent program (so I rarely write my own read/write functions). I have to update what I consider an error-prone way of scanning and parsing a given file (known format).
I've gone through a number of posts in this forum on scanning/parsing text files with C functions. Usually, a newbie posts some first-try, and then others suggest good and not so good changes to the initial code. Sometimes, the low-level char-by-char manipulation seems to be one of the less error-prone ways of doing it.
I'd like to tackle this from another angle: has anyone come across well-written published C code that scans/parses and that has prompted one to say: "Now, that's the way to do it! Code to emulate for a newbie!". What I mean by 'published' is that it's actually found in a distributed program. Of course, anything open source GPL (most of Linux) would be appropriate as an example since the source code is accessible.