00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <stdio.h>
00023 #include <afxinet.h>
00024 #include <Win32ftp.h>
00025
00026 vmd_ftpclient(const char * site,
00027 const char * remotefile,
00028 const char * localfile) {
00029 CInternetSession S("Eagle FTP");
00030 CFtpConnection *f;
00031
00032 try {
00033 f = S.GetFtpConnection(site,
00034 "anonymous",
00035 "anonymous@anonymous.org",
00036 21,
00037 FALSE);
00038 f->SetCurrentDirectory("/");
00039 f->GetFile(remotefile, localfile,
00040 FALSE,
00041 FILE_ATTRIBUTE_NORMAL,
00042 FTP_TRANSFER_TYPE_BINARY,
00043 1);
00044
00045 delete f;
00046 S.Close();
00047
00048 return FTP_SUCCESS;
00049 }
00050
00051 catch (CInternetException) {
00052 printf("FTP Error!\n");
00053 return FTP_FAILURE;
00054 }
00055
00056 return FTP_SUCCESS;
00057 }
00058
00059 #if defined(FTPMAIN)
00060 int main(int argc, char **argv) {
00061 int rc;
00062 printf("VMD Win32 FTP Client\n");
00063 if (argc != 4) {
00064 printf("usage: %s ftp.rcsb.org /pub/README README.txt\n", argv[0]);
00065 return FTP_FAILURE;
00066 }
00067
00068 printf("%s:%s:%s\n",argv[1], argv[2], argv[3]);
00069
00070 rc=vmd_ftpclient(argv[1], argv[2], argv[3]);
00071
00072 if (rc != FTP_SUCCESS) {
00073 printf("FTP failed.\n");
00074 }
00075 return rc;
00076 }
00077 #endif
00078