next up previous contents
Next: Возвращаемые коды для FTP Up: Приложения Previous: Описание FTP библиотеки.

  
Пример пользовательской программы

/*******************************************************************/
/* fcp.c: copy files from HOST1 to HOST2 */
/* Vladimir N.Chernenkov <vch*At*sao.ru>, N.Arkhyz, feb 1994 */
/* We usage standard FTP protocol with ftlib.a */
/* if input-file name eq "-" then use "stdin" */
/*******************************************************************/

#include "ftlib.h"

main( a, b)
int a;
char **b;
{
FILE *out,*in;
int c;
if ( a != 3 ) {
fprintf(stderr,
"Usage: %s [host1:user:passwd:]input-file [host2:user:passwd:]out-file \n", b[0]);
exit(1);
}
if ((in=FtFullOpen(b[1],"r"))==NULL) { perror(b[1]); exit(1);}
if ((out=FtFullOpen(b[2],"w"))==NULL) { perror(b[2]); exit(1);}

while((c=getc(in))!=EOF) putc(c,out);
FtFullClose(in);
FtFullClose(out);
}

Vladimir Chernenkov
2000-10-09