-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwork.txt
36 lines (25 loc) · 852 Bytes
/
work.txt
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
/* Code snippet from a simulation of a FTP server,
function creating a map containing <string, string> pairs,
representing <username, password>. */
void buildUserMap(map<string, string> &map, char* filename){
int N, status;
string user, pass;
string path;
ifstream in (filename);
if (in.is_open()) {
in >> N;
for(int i=1; i<=N; i++) {
in >> user >> pass;
users.push_back(user);
map.insert( pair<string, string> (user,pass));
path = "./" + user;
//make directories for each new user
status = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
/*if(status < 0){
perror("Error creating directory");
}*/
}
in.close();
} else
perror("Unable to open file");
}