unix下文件移动的问题
代码如下:
if( (stream = fopen(sSourceFile,"r")) == NULL) //判断文件是否存在
{
return NOTFINDFILE;
}
else //文件存在,把文件移到别的地方
{
fclose(stream);
sprintf(sCommand,"mv %s %s",sSourceFile,sDesFile);
if( popen(sCommand,"r")==NULL )
printf("移动失败");
else
printf("移动成功");
}
执行后可以生成sDesFile,但是字节数为0,而且sSourceFile还存在,这是什么原因?