我已经编写了一个 c++ 库来remove
使用Visual C++ 2005
. 但它不会删除文件。我该如何解决这个问题?
示例代码如下:
FILE *fp;
char temp[10000];
char *filename;
GetCurrentDirectoryA(10000,temp);
strcat(temp,"\\temp.png");
filename = (char*)malloc(sizeof(char)*strlen(temp));
memset(filename,'\0',strlen(temp));
strcpy(filename,temp);
if(png == NULL)
return LS_ARGUMENT_NULL;
fp = fopen(filename,"wb");
fwrite(png,sizeof(unsigned char),pngLength,fp);
fclose(fp);
result = remove(filename);