#include
void main(int argc, char *argv[])
{
FILE *fp;
char str[255];
char ip[100]="10.144.15.200";
char user[20]="nari";
char pass[20]="nari";
char fname[100]="11";
if((fp = popen("ftp -n","w"))==NULL) {
puts("RUN ftp fail!\n");
exit(0);
}
fprintf(fp, "open %s\n", ip);
fprintf(fp, "user %s %s\n", user, pass);
fprintf(fp, "prompt\n");
fprintf(fp, "mget %s\n", fname);
fprintf(fp, "delete %s\n", fname);
fprintf(fp, "bye\n");
pclose(fp);
}
编译参数:
cc -o test test.c
阅读(1435) | 评论(0) | 转发(0) |