MiiCSV是一个基于c++文件流的小巧而灵活的CSV库。
示例1:(使用csv:制表符分隔的值写入文件:ofstream类)
#iclude "miicsv.h"struct Product{ Product() : ame(""), qty(0), price(0.0f) {} Product(std::strig ame_, it qty_, float price_) : ame(ame_), qty(qty_), price(price_) {} std::strig ame; it qty; float price;};it mai(){ csv::ofstream os("products.txt", std::ios_base::out); os.set_delimiter('\t'); if(os.is_ope()) { Product product("Shampoo", 200, 15.0f); os << product.ame << product.qty << product.price << NEWLINE; Product product2("Soap", 300, 6.0f); os << product2.ame << product2.qty << product2.price << NEWLINE; } os.flush(); retur 0;}
评论