Click here to Skip to main content
11,935,053 members (55,201 online)
Rate this:
Please Sign up or sign in to vote.
See more: VC8.0 C++
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?
Posted 23-May-11 19:57pm
S Mewara 24-May-11 1:41am
Any effort?
Gokulnath007 24-May-11 1:57am
I have used URLDownloadToFile and downloaded the file to hard disk, but i just want to read the contents of the file instead of saving to the system.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

And process the buffer in your lpCompletionRoutine callback
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi Gokulnath,

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

InternetReadFile ->[^]

Example ->[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 24 May 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100