How to read text from internet with C++

爱⌒轻易说出口 提交于 2019-12-25 03:26:43

问题


I trying get text data from internet with C++ but I couldn't find anything useful.

like python;

import urllib
data = urllib.urlopen("examplesite.com/data.txt").read()

回答1:


Take a look at libcurl. It is a C library, with C++ bindings.

The libcurl website includes a collection of examples in C, including one that copies a URL to a block of memory, getinmemory.c

For C++, the main page of the curlcpp binding at https://github.com/JosephP91/curlcpp shows an example of downloading a URL to a file.



来源:https://stackoverflow.com/questions/28508236/how-to-read-text-from-internet-with-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!