c-resources/CPlusPlus20ForProgrammers-m.../examples/libraries/rapidcsv/examples/ex002.cpp

22 lines
559 B
C++
Raw Normal View History

2024-04-09 06:45:18 +00:00
#if 0
TMP=$(mktemp -d)
c++ -std=c++11 -I src -o ${TMP}/a.out ${0} && ${TMP}/a.out ${@:1} ; RV=${?}
rm -rf ${TMP}
exit ${RV}
#endif
#include <iostream>
#include <vector>
#include "rapidcsv.h"
int main()
{
rapidcsv::Document doc("examples/colrowhdr.csv", rapidcsv::LabelParams(0, 0));
std::vector<float> close = doc.GetRow<float>("2017-02-22");
std::cout << "Read " << close.size() << " values." << std::endl;
long long volume = doc.GetCell<long long>("Volume", "2017-02-22");
std::cout << "Volume " << volume << " on 2017-02-22." << std::endl;
}