问题
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