我使用vc ++ 6.0
创建一个名为newEntry.txt的文件memset(szLogPath,'\0',sizeof(szLogPath));
strcpy(szLogPath, g_szInstallDir);
strcat(szLogPath, "newentry.txt");
我正在写一些内容
file。我需要在运行代码时创建一个新文件,而不是在旧的
中编写file.I能够创建文件但是如果我尝试使用
删除文件remove("szLogPath");
它没有删除,内容最后附加。如何删除该文件?
任何人都可以告诉我要删除该文件需要做什么?
答案 0 :(得分:0)
szLogPath
应该用作变量,而不是字符串。
int remove ( const char * filename );
所以它应该是
remove(szLogPath);
不是remove("szLogPath");