code: загрузка файла по сети

main
FilippovDY 11 месяцев назад
Родитель 95220556fa
Сommit 525faaf72b

@ -7,7 +7,8 @@
using namespace std; using namespace std;
struct Input { struct Input
{
vector<double> numbers; vector<double> numbers;
size_t bin_count{}; size_t bin_count{};
size_t number_count{}; size_t number_count{};
@ -15,20 +16,24 @@ struct Input {
}; };
Input Input
input_data(istream& stream, bool prompt) { input_data(istream& stream, bool prompt)
{
size_t number_count; size_t number_count;
if (prompt) { if (prompt)
cerr << "Enter number count: "; {
cerr << "Enter number count: ";
} }
stream >> number_count; stream >> number_count;
Input in; Input in;
if (prompt) { if (prompt)
cerr << "Enter bin count: "; {
cerr << "Enter bin count: ";
} }
stream >> in.bin_count; stream >> in.bin_count;
vector<double> numbers(in.number_count); vector<double> numbers(in.number_count);
in.numbers.resize(in.number_count); in.numbers.resize(in.number_count);
for (size_t i = 0; i < in.number_count; i++) { for (size_t i = 0; i < in.number_count; i++)
{
stream >> in.numbers[i]; stream >> in.numbers[i];
} }
size_t bin_count; size_t bin_count;
@ -39,14 +44,19 @@ input_data(istream& stream, bool prompt) {
int main(int argc, char* argv[]){ int main(int argc, char* argv[])
{
if (argc > 1){ if (argc > 1)
auto i = 0; {
while (i < argc){ CURL* curl = curl_easy_init();
cerr << "arg[" << i << "] = " << argv[i] << endl; if(curl)
i++; {
} CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0; return 0;
} }
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);

Загрузка…
Отмена
Сохранить