• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

Downloading a binary file from a HTTP server

I have managed to make a connection and download a standard web page from a server using the ReadString method of the CInternetFile class. Downloading a binary and saving it to disk is however still eluding me.

I use VC++6 and I'm still new to the language (coming from a Java/VB backround) so please be gentle.
1 Solution
on FTP connection, you can use CFtpConnection::OpenFile with flag FTP_TRANSFER_TYPE_BINARY ... but on HTTP ..??
BTW: there is MFC section, perhaps you will get better respones there.

This is from the TEAR.EXE MFC sample program:

    TCHAR sz[1024];
    UINT nRead;
    nRead = pFile->Read(sz, 1023);
    while (nRead > 0)
        sz[nRead] = '\0';
        if (bStripMode)
        cout << sz;
        nRead = pFile->Read(sz, 1023);
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now