Guide to good text file IO C/C++ on linux
I often find myself needing to write functions to load/save from/to ASCII (or similar) text files; such as config files or data. I can and have done so many times but never feel like I do it well. ie the results are not very tolerant of minor changes to the file format.
Can anyone point me to a good guide to writing robust开发者_开发技巧 text file io or even better some libraries to make it easier?
Off the top of my head, there's:
- Glib's key-value file parser
- YAML
Both of these are pretty standard under linux.
YAML is a really good choice. Here we use yaml-cpp
my2c
精彩评论