-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
100 lines (78 loc) · 1.74 KB
/
test.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#define _GLIBCXX_USE_CXX11_ABI 0
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <ctime>
#include <sys/stat.h>
#include <string>
#include <sstream>
using namespace std;
string hme = "/home/fdai5587/ws/testdata";
template <typename T>
string ntos(T pNumber)
{
ostringstream oOStrStream;
oOStrStream << pNumber;
return oOStrStream.str();
}
void maked(string d, int n){
string ds = d + ntos(n);
const char * dsc = ds.c_str();
int dsd = mkdir(dsc, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}
void dir(int a, int b, int c){
maked ("p", a);
//string hme = "/home/fdai5587/ws/testdata";
string s = hme + "/p" + ntos(a);
const char * cs = s.c_str();
int dd;
dd = chdir(cs);
char the_path[256];
getcwd(the_path, 255);
cout<< the_path<<endl;
maked ("g", b);
string s1 = s+"/g"+ntos(b);
const char * cs1 = s1.c_str();
dd = chdir(cs1);
getcwd(the_path, 255);
cout<< the_path<<endl;
maked ("t", c);
string s2 = s1+"/t"+ntos(c);
const char * cs2 = s2.c_str();
dd = chdir(cs2);
getcwd(the_path, 255);
cout<< the_path<<endl;
}
int main(){
//change directory to ... testdata
const char * home = hme.c_str();
int h;
// h = chdir(home);
chdir(home);
int p;
cout << "Enter person number (1-10): ";
cin >> p;
int g;
cout << "Enter gesture class (1-4): ";
cin >> g;
int t;
cout << "Enter try number (1-10): ";
cin >> t;
dir(p,g,t);
}
/*
int main(){
int status;
status = mkdir("testdata", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
char the_path[256];
getcwd(the_path, 255);
cout<< the_path<<endl;
string st = "/home/fdai5587/ws/testdata";
const char * strs = st.c_str();
int x;
x = chdir(strs);
getcwd(the_path, 255);
cout<< the_path<<endl;
return 0;
}
*/