I'm looking for some example C++ code to read an FTP file just like any
other file i.e. read/pull the file in variable-length chunks.  Specifically,
I need to implement an interface like this (without having to first download
the entire file ahead of time):

class IInputStream
{
public:
    virtual unsigned int Read(char *buffer, unsigned int bufferSize)  =0;
};

Example usage:

    IInputStream* s = factory.CreateProtocolStream( url );  // e.g. file: or
ftp:

    while (bytesRead = s->Read(buffer, 1024) > 0)
    {
        Parser::Result result;
        if (!Parser::Parse(buffer, bytesRead, &result))
            break;
        /* ... */
    }


Thanks!
Rich
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to