forked from andreacasalino/csvcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWriteResults.cpp
More file actions
26 lines (19 loc) · 780 Bytes
/
WriteResults.cpp
File metadata and controls
26 lines (19 loc) · 780 Bytes
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
#include <csvpp/Write.h>
#include <iostream>
/////////////////////////////////////////////////////////////////////////////////////////////////
// TODO
/////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
const std::string csvDestination = "results.csv";
{
csvpp::Writer<std::string, std::string, int, float> writer(
csvDestination, "Name", "Surname", "age", "weight");
// write row one by one
writer.add("Paolo", "Rossi", 34, 81.3f);
writer.add("Valeria", "Verdi", 25, 55.7f);
writer.add("mario", "Neri", 21, 75.4f);
}
// writer went out of the scope, data was automatically flushed
std::cout << "Data persisted into: " << csvDestination << std::endl;
return EXIT_SUCCESS;
}