Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Downloading a binary file from a HTTP server

Posted on 1999-07-09
2
Medium Priority
?
189 Views
Last Modified: 2010-04-16
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.
0
Comment
Question by:ecraigh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

by:nil_dib
ID: 1199616
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.

0
 
LVL 2

Accepted Solution

by:
cpopin earned 150 total points
ID: 1199617
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)
            StripTags(sz);
        cout << sz;
        nRead = pFile->Read(sz, 1023);
    }
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question