Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading parts of a file via FTP

Status
Not open for further replies.

ccampbell

Programmer
Aug 16, 2001
201
US
Hello,
I am using VC++ and MFC programming and I have a slight problem. I have a remote file that I am downloading via the GetFile() (CFtpConnection) function. The file that I am copying down gets appended to very regularly so it is constantly growing. Is there a way that I can just download the new information in the remote file and not the entire file each time? Thanks for any help.
 
you might have to go down to sockets.

Or, you can use Wininet. Yank the internet handle out of the CFtpConnection (or open your own). Instead of doing FtpOpenFile(), open the transfer connection manually using FtpCommand to send each of the ftp commands:
REST startpoint \n
PASV \n
RETR thefile \n

For the last one you should send a pointer to the handle you will read from as the last parameter.

FtpCommand(hServerHandle, true, FTP_TRANSFER_TYPE_BINARY, "RETR thefile \n", NULL, &hFileHandle);

Then do your InternetReadFile on the file handle.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top