-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.cpp
40 lines (26 loc) · 1.02 KB
/
example.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <string>
#include "src/csv.hpp"
int main(int argc, char** argv)
{
std::string data = "name,age,city\n"
"John,18,New-York\n"
"Edouard,34,Washington";
csv::doc document (data);
/**************************************************/
std::cout << "** John Informations **" << std::endl;
csv::row johnrow = document[1];
for(int i = 0; i < johnrow.size(); i++)
std::cout << johnrow[i] << std::endl;
/*****************************************************/
std::cout << "** Edouard Informations **" << std::endl;
csv::row edouardrow = document[2];
for(int i = 0; i < edouardrow.size(); i++)
std::cout << edouardrow[i] << std::endl;
/********************************************/
std::cout << "** Add New Row **" << std::endl;
csv::row newrow({"Steve", "16", "Cuppertino"});
document.append(newrow);
std::cout << document.tostring() << std::endl;
return EXIT_SUCCESS;
}