-
Notifications
You must be signed in to change notification settings - Fork 1
/
csv.cpp
47 lines (39 loc) · 867 Bytes
/
csv.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
41
42
43
44
45
46
47
/*
* zachowajta mój email i róbta co chceta.
*/
/*
* File: csv.cpp
* Author: fajnysoft@gmail.com
*
* Created on 22 kwietnia 2017, 19:27
*/
#include "csv.h"
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <stdio.h>
using namespace std;
CSV::CSV() {
}
CSV::CSV(string fName) {
fileName = fName;
CSV::file.open(fName.c_str(),ios_base::app);
}
CSV::~CSV() {
CSV::file.close();
}
void CSV::addToRecord(float fPomiar){
char sPomiar[32];
setlocale(LC_ALL, "Polish");
sprintf(sPomiar, "%f", fPomiar);
CSV::record += sPomiar;
CSV::record += ";";
setlocale(LC_ALL, "USA");
//cout<<csv::record<<endl;
}
void CSV::storeRecord(){
CSV::record = CSV::record.substr(0, CSV::record.size()-1);
CSV::record += "\n";
CSV::file.write(CSV::record.c_str(), CSV::record.size());
CSV::record = "";
}