home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume38 / libftp / part01 / get.c < prev    next >
C/C++ Source or Header  |  1993-07-13  |  477b  |  28 lines

  1. #include "FtpLibrary.h"
  2.  
  3. main(int a,char **b)
  4. {
  5.   FILE *out,*in;
  6.   String localfile;
  7.   int c;
  8.   
  9.  
  10.   if ( a != 2 )
  11.     {
  12.       fprintf(stderr,
  13.           "Usage: %s node/user/pass:input-file\n",
  14.           b[0]);
  15.       exit(1);
  16.     }
  17.   if ((in=FtpFullOpen(b[1],"r"))==NULL)
  18.     perror(b[1]),exit(1);
  19.   sscanf(b[1],"%*[^:]:%s",localfile);
  20.   if ((out=fopen(localfile,"w"))==NULL)
  21.     perror(b[2]),exit(1);
  22.  
  23.   while((c=getc(in))!=EOF)
  24.     putc(c,out);
  25.   FtpFullClose(in);
  26.   fclose(out);
  27. }
  28.