请教个问高手,以下文件FTP上传的程序会出现不发生异常而文件不上传成功的情况吗?因为现在出现没有错误日志但是文件且没有正确上传的情况,领导让查原因,又没日志可看,只好求助各位大大,从这段程序上入手了:
int FtpPutfile(FTP_INFO *pftp_info)
{
char shell_name[101];
char str_tmp[101];
FILE *shfp;
int ret ;
memset(shell_name,0,sizeof(shell_name));
sprintf(shell_name,”%s/ftp_shell.dat”,pftp_info->ftp_path_loc);
shfp=fopen(shell_name,”w”);
if(shfp==NULL)
{
tlevel_userprint(LOG_INFO,”Can’t create file [%s].\n”,shell_name);
return -1;
}
//将对帐文件通过FTP上传
memset(str_tmp,0,sizeof(str_tmp));
sprintf(str_tmp,”open %s\n”,pftp_info->ftp_ip);
fputs(str_tmp,shfp);
memset(str_tmp,0,sizeof(str_tmp));
sprintf(str_tmp,”user %s %s\n”,pftp_info->ftp_user,pftp_info->ftp_pwd);
fputs(str_tmp,shfp);
memset(str_tmp,0,sizeof(str_tmp));
sprintf(str_tmp,”lcd %s\n”,pftp_info->ftp_path_loc);
fputs(str_tmp,shfp);
memset(str_tmp,0,sizeof(str_tmp));
sprintf(str_tmp,”cd %s\n”,pftp_info->ftp_path_rmt);
fputs(str_tmp,shfp);
fputs(“bin\n”,shfp);
memset(str_tmp,0,sizeof(str_tmp));
sprintf(str_tmp,”put %s\n”,pftp_info->file_name);
fputs(str_tmp,shfp);
fputs(“bye\n”,shfp);
fclose(shfp);
memset(str_tmp,0,sizeof(str_tmp));
sprintf(str_tmp,”ftp -n < %s”,shell_name);
ret = system(str_tmp);
ret=WEXITSTATUS(ret); /* 取得返回值 */
return ret;
}
>> 本文固定链接: http://www.vcgood.com/archives/3194