forked from pt209223/librs
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_rs.cpp
More file actions
49 lines (39 loc) · 962 Bytes
/
test_rs.cpp
File metadata and controls
49 lines (39 loc) · 962 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
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "RS.h"
#include <iostream>
#include <cstdlib>
using std::cout;
using std::endl;
using std::exception;
int main(void)
{
cout << "[TEST] Start" << endl;
RS rs;
RS::Info info;
int i = 0;
rs.set_log_stderr();
while (true) {
try {
const char *url = "http://rapidshare.com/files/31754685/Napisy.rar";
//char url[1024];
//snprintf(url, 1024, "http://rapidshare.com/files/01234567/test_nr_%drar", i);
cout << "[TEST] Dodajemy: " << url << endl;
rs.download(url);
do {
rs.get_info(info);
sleep(1);
cout << "[TEST] Czekamy..." << endl;
} while (
info.status != RS::Downloaded &&
info.status != RS::Canceled &&
info.status != RS::NotFound);
cout << "[TEST] Mamy: " << url << endl;
++i;
break;
}
catch (exception &e) {
cout << "[TEST] Wyjatek: " << e.what() << endl;
}
}
rs.close();
return 0;
}