code: Добавлена работа с cURL
Этот коммит содержится в:
@@ -31,7 +31,12 @@
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add directory="curl/include" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="libcurl.dll.a" />
|
||||
<Add directory="curl/lib" />
|
||||
</Linker>
|
||||
<Unit filename="histogram.cpp" />
|
||||
<Unit filename="histogram.h" />
|
||||
<Unit filename="main.cpp" />
|
||||
|
||||
15
main.cpp
15
main.cpp
@@ -3,6 +3,7 @@
|
||||
#include <vector>
|
||||
#include "histogram.h"
|
||||
#include "text.h"
|
||||
#include <curl/curl.h>
|
||||
using namespace std;
|
||||
|
||||
struct Input {
|
||||
@@ -30,7 +31,19 @@ Input input_data(istream& in, bool prompt)
|
||||
return inn;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int argc, char*argv[]) {
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
if (argc > 1)
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
CURLcode res;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
|
||||
res = curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
|
||||
auto in = input_data(cin, true);
|
||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||
show_histogram_svg(bins);
|
||||
|
||||
Ссылка в новой задаче
Block a user