如何使用C ++从互联网上阅读文本 [英] How to read text from internet with C++

查看:159
本文介绍了如何使用C ++从互联网上阅读文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



like python;

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


解决方案

查看 的libcurl 。它是一个C库,带有 C ++绑定



libcurl网站包含C语言中的示例集合,其中包括一个将URL复制到一块内存中, getinmemory.c



对于C ++, curlcpp 的主页在<一个href =https://github.com/JosephP91/curlcpp =nofollow> https://github.com/JosephP91/curlcpp 展示了一个将URL下载到文件的例子。 p>

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()

解决方案

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.

这篇关于如何使用C ++从互联网上阅读文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆