好的,这就是我正在使用的功能remove():
int fmove(const char * filepth, const char * destpth)
{
FILE * fp;
fp = fopen(filepth, "r+");
FILE * fpdest;
fpdest = fopen(destpth, "w");
if ((fp != NULL) && (fpdest != NULL))
{
char fpdata[999];
fgets(fpdata, 999, fp);
fputs(fpdata, fpdest);
remove(filepth);
} else
{
prtmessage("ERROR", "Cannot move file!");
return 1;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但remove()返回-1。我知道数组返回它们的指针(我说得对吗?),但是有没有办法将字符串传递到filepathto remove()?