-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlmsrj.cpp
More file actions
69 lines (55 loc) · 1.17 KB
/
lmsrj.cpp
File metadata and controls
69 lines (55 loc) · 1.17 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* File: lmsrj.cpp
* Author: rvlander
*
* Created on 23 mai 2012, 10:57
*/
#include<string>
#include<iostream>
#include<fstream>
#include<vector>
using namespace std;
/*
*
*/
void readMFile(char * path) {
ifstream fp(path);
char ligne[1024];
string ll,lcmd;
vector<string> args;
int posi, posf;
bool stop = false;
//reading header %A,B,C
fp.getline(ligne, 1024);
ll = ligne;
ll.erase(0, 1);
posi = 0;
posf = 0;
while (!stop) {
posf = ll.find(",", posi);
//cout << posf << endl;
if (posf == -1)
stop = true;
else {
args.push_back(ll.substr(posi, posf -posi));
posi = posf + 1;
}
}
args.push_back(ll.substr(posi, ll.size()));
while(fp.getline(ligne,1024)){
ll = ligne;
cout << ligne <<endl;
}
lcmd = args[0];
for (int i = 1; i < args.size(); i++) {
lcmd+=","+args[i];
}
string spath(path);
lcmd = "exportVar('"+spath+".java.in'," +lcmd+");";
cout << lcmd << endl;
}
int main(int argc, char** argv) {
char* mscript = argv[1];
readMFile(mscript);
return 0;
}