Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Win32ftp.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 /***************************************************************************
00009  * RCS INFORMATION:
00010  *
00011  *      $RCSfile: Win32ftp.C,v $
00012  *      $Author: johns $        $Locker:  $             $State: Exp $
00013  *      $Revision: 1.15 $      $Date: 2020/02/26 14:40:13 $
00014  *
00015  ***************************************************************************/
00021 #include <stdio.h>
00022 #include <afxinet.h> 
00023 #include <Win32ftp.h>
00024 
00025 vmd_ftpclient(const char * site, 
00026             const char * remotefile, 
00027             const char * localfile) {
00028   CInternetSession S("Eagle FTP"); 
00029   CFtpConnection *f; 
00030 
00031   try { 
00032     f = S.GetFtpConnection(site,
00033                            "anonymous",
00034                            "anonymous@anonymous.org",
00035                            21,
00036                            FALSE); 
00037     f->SetCurrentDirectory("/"); 
00038     f->GetFile(remotefile, localfile,
00039                FALSE,
00040                FILE_ATTRIBUTE_NORMAL,
00041                FTP_TRANSFER_TYPE_BINARY,
00042                1);
00043     
00044     delete f; 
00045     S.Close(); 
00046   
00047     return FTP_SUCCESS;
00048   } 
00049 
00050   catch (CInternetException) { 
00051     printf("FTP Error!\n"); 
00052     return FTP_FAILURE;
00053   } 
00054 
00055   return FTP_SUCCESS;
00056 } 
00057 
00058 #if defined(FTPMAIN)
00059 int main(int argc, char **argv) {
00060   int rc;
00061   printf("VMD Win32 FTP Client\n");
00062   if (argc != 4) {
00063     printf("usage: %s ftp.rcsb.org /pub/README README.txt\n", argv[0]);
00064     return FTP_FAILURE;
00065   }
00066 
00067   printf("%s:%s:%s\n",argv[1], argv[2], argv[3]);
00068 
00069   rc=vmd_ftpclient(argv[1], argv[2], argv[3]);   
00070 
00071   if (rc != FTP_SUCCESS) {
00072     printf("FTP failed.\n"); 
00073   }
00074   return rc;
00075 }
00076 #endif
00077 

Generated on Wed Apr 24 02:43:40 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002