-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (34 loc) · 919 Bytes
/
Copy pathmain.cpp
File metadata and controls
36 lines (34 loc) · 919 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
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <curl/curl.h>
#include <iostream>
#include <cstring>
#include "sendReceiver/sendReceiver.h"
int main(int argc, char** argv) {
std::string contents, data;
char *filename = new char[256];
if (argc == 3 && strncmp(argv[1], "-i", 2) == 0) {
std::string id = static_cast<std::string>(argv[2]);
SendReceiver ctrl;
ctrl.getInfoReq(id);
}
else if (argc == 2) {
strcpy(filename, argv[1]);
SendReceiver ctrl;
ctrl.uploadFile(filename);
}
else if (argc == 1) {
std::cout << "Enter filename: ";
std::cin.getline(filename, 256);
SendReceiver ctrl;
ctrl.uploadFile(filename);
}
else {
std::cerr << "Error too many arguments provided, usage: anonfile <your_path_to_file>\n"
<< "File path must be without spaces.\n";
return -1;
}
delete[] filename;
std::cout << "Press ENTER to exit.\n";
std::cin.get();
return 0;
}