在CentOS7使用rapidcsv.h在C++读写csv文件

  • rapidcsv.h

    github

    Rapidcsv is a C++ header-only library for CSV parsing. While the name admittedly was inspired by the rapidjson project, the objectives are not the same. The goal of rapidcsv is to be an easy-to-use CSV library enabling rapid development.

    Rapidcsv is implemented using C++11.

  • Installation

Simply copy src/rapidcsv.h to your project/include directory and include it.

  • Reading a File with Column and Row Headers

By default rapidcsv treats the first row as column headers, and the first column is treated as data.

This allows accessing columns using their labels, but not rows or cells (only using indices). In order to treat the first column as row headers one needs to use LableParams and set pRowNameIdx to 0.

  • Supported Get/Set Data Types

The internal cell representation in the Document class is using std::string and when other types are requested, standard conversion routines are used. All standard conversions are relatively straight-forward, with the exception of char for which rapidcsv interprets the cell’s (first) bytes as a character.

  • API Documentation
  1. class rapidcsv::Document
  2. class rapidcsv::SeparatorParams
  3. class rapidcsv::LabelParams
  4. class rapidcsv::ConverterParams
  5. class rapidcsv::no_converter
  6. class rapidcsv::Converter< T >
  • References

  1. Reading And Writing CSV Files With C++
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值