开发者

Guide to good text file IO C/C++ on linux

开发者 https://www.devze.com 2023-03-09 18:03 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消