Сравнить коммиты
1 Коммитов
a0b2bfa8bc
...
main
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
6188e4961c |
Двоичные данные
lab_3.xcodeproj/project.xcworkspace/xcuserdata/lesaminov.xcuserdatad/UserInterfaceState.xcuserstate
сгенерированный
Двоичные данные
lab_3.xcodeproj/project.xcworkspace/xcuserdata/lesaminov.xcuserdatad/UserInterfaceState.xcuserstate
сгенерированный
Двоичный файл не отображается.
@@ -50,6 +50,12 @@
|
||||
ReferencedContainer = "container:lab_3.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "http://uit.mpei.ru/study/courses/cs/lab03/marks.txt"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
15
main.cpp
15
main.cpp
@@ -34,13 +34,22 @@ Input input_data(istream& in, bool prompt)
|
||||
}
|
||||
|
||||
size_t
|
||||
write_data(void* items, size_t item_size, size_t item_count, void* ctx) {
|
||||
stringstream* buffer = reinterpret_cast<stringstream*>(ctx);
|
||||
write_data(void* items, size_t item_size, size_t item_count, void* ctx)
|
||||
{
|
||||
size_t data_size = item_size * item_count;
|
||||
stringstream *buffer = reinterpret_cast<stringstream*>(ctx);
|
||||
(*buffer).write(reinterpret_cast<const char*>(items), data_size);
|
||||
return data_size;
|
||||
}
|
||||
|
||||
size_t
|
||||
write_header(char* buffer, size_t size, size_t nitems, void* userdata)
|
||||
{
|
||||
cerr << "Headers: " << buffer << endl;
|
||||
return size * nitems;
|
||||
}
|
||||
|
||||
|
||||
Input
|
||||
download(const string& adress){
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
@@ -52,6 +61,8 @@ download(const string& adress){
|
||||
curl_easy_setopt(curl, CURLOPT_URL, adress.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_header);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERDATA, NULL);
|
||||
res = curl_easy_perform(curl);
|
||||
if (res != CURLE_OK)
|
||||
{
|
||||
|
||||
Ссылка в новой задаче
Block a user