code: обработка ошибок
Этот коммит содержится в:
12
main.cpp
12
main.cpp
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
struct Input {
|
struct Input {
|
||||||
vector<double> vec;
|
vector<double> vec;
|
||||||
size_t korz{};
|
size_t korz{};
|
||||||
@@ -43,20 +42,27 @@ int main(int argc, char* argv[]) {
|
|||||||
curl_global_init(CURL_GLOBAL_ALL);
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
|
||||||
const char *url = argv[1];
|
const char *url = argv[1];
|
||||||
|
|
||||||
CURL *curl = curl_easy_init();
|
CURL *curl = curl_easy_init();
|
||||||
if (curl) {
|
if (curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||||
curl_easy_perform(curl);
|
|
||||||
|
CURLcode res = curl_easy_perform(curl);
|
||||||
|
if (res != CURLE_OK) {
|
||||||
|
cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto in_with_prompt = input_data(cin, true);
|
auto in_with_prompt = input_data(cin, true);
|
||||||
auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec);
|
auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec);
|
||||||
show_histogram_svg(bins_with_prompt);
|
show_histogram_svg(bins_with_prompt);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user