mfc文件操作优质文档.docVIP

  • 2
  • 0
  • 约9.13万字
  • 约 78页
  • 2026-07-24 发布于江苏
  • 举报

创建文件夹

CreateDirectory(%%1,NULL);稳哥有错误自己调试啊。

2.创建文件

CFilefile;

file.Open(%%1,CFile::modeCreate|CFile::modeWrite);

3.删除文件

DeleteFile(%%1);

4.删除文件夹

RemoveDirectory(%%1);

5.删除一个目录下所有的文件夹

CFileFindfinder;

CStringpath;

path.Format(%s\\*.*,%%1);

BOOLbWorking=finder.FindFile(path);

while(bWorking)

{

bWorking=finder.FindNextFile();

if(finder.IsDirectory())

{

RemoveDirectory(finder.GetFilePath());

}

}

6.清空文件夹

RemoveDirectory(%%1);

CreateDirectory(%%1,NULL);

7.读取文件

charsRead[5120];

CFilemFile(_T(%%1),CFile::modeRead);

while(sRead!=NULL)

{

文档评论(0)

1亿VIP精品文档

相关文档