如何使用URL读取文件? [英] How to read the file using the URL?

查看:126
本文介绍了如何使用URL读取文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用URL读取文件?使用URLDownloadToFile.是否要读取文件并将其保存在变量中,而不是将文件保存在硬盘中?

How to read the file using the URL?Using URLDownloadToFile. Want to read the file and saving it in a variable instead of saving the file in hard disk?

推荐答案

在重叠的操作中:

呼叫 WSASend [
In a overlapped operation:

Call WSASend[^] with lpBuffers point to the file you want to download, for example:

WSABUF sendBuf;
sendBuf.buf = "GET /index.html HTTP/1.1\r\n\r\n";
sendBuf.len = strlen( sendBuf.buf );

WSASend( sock, &sendBuf, 1, &dwBytes, 0, &recvOv, SendComplete );



并在lpCompletionRoutine回调中处理缓冲区
WSARecv [



And process the buffer in your lpCompletionRoutine callback
WSARecv[^]


您好,Gokulnath,

根据您的评论,一种方法是
1)读取您在缓冲区中下载的文件,然后删除它.

2)我对此不确定,但是我找到了一个API

InternetReadFile
-> [示例-> [ ^ ]
Hi Gokulnath,

As per your comments one way is
1) Read the file that you download in a buffer and than delete it.
and
2) I am not sure about this but I found one API

InternetReadFile ->[^]

Example ->[^]


这篇关于如何使用URL读取文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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