vc知识积累(4.文件操作)
2006-07-29 10:29
204 查看
1. 查询某目录下全部文件:
CFileFind cff;
CString dir( "E://English//family" );
if( cff.FindFile( dir + "//*.*" ) )
{
while( cff.FindNextFile() )
{
CString filename = cff.GetFileName();
}
}
2. 创建新目录
CString newDir( "E://English//走遍美国" );
CreateDirectory( newDir, NULL );
3. 拷贝文件
CString oldFileName;
oldFileName.Format( "%s//%s", oldDir, oldFileName );
CString newFileName;
newFileName.Format( "%s//%s", newDir, newFileName );
CopyFile( sourceFileName, destFileName, FALSE );
CFileFind cff;
CString dir( "E://English//family" );
if( cff.FindFile( dir + "//*.*" ) )
{
while( cff.FindNextFile() )
{
CString filename = cff.GetFileName();
}
}
2. 创建新目录
CString newDir( "E://English//走遍美国" );
CreateDirectory( newDir, NULL );
3. 拷贝文件
CString oldFileName;
oldFileName.Format( "%s//%s", oldDir, oldFileName );
CString newFileName;
newFileName.Format( "%s//%s", newDir, newFileName );
CopyFile( sourceFileName, destFileName, FALSE );
相关文章推荐
- vc知识积累(2.操作Excel数据库)
- vc知识积累(2.操作Excel数据库)
- python知识积累(四)——文件操作
- 积累的VC编程小技巧之文件操作
- vc知识积累(2.操作Excel数据库)
- 【基础知识】文件的读写操作
- iOS基础知识:文件流以及文件操作中的主要函数
- VC:文件操作大全,打开,保存,复制,删除,查找等
- VC++文件操作之最全篇
- VC++文件操作之最全篇
- BMP位图文件结构及VC操作
- c++/vc删除文件操作
- 剖析VC中的文件操作
- vc中常用文件操作(二) Ini文件操作
- 剖析VC中的文件操作
- 孙鑫VC++视频教程(12)文件操作
- VC中文件操作的几种方式(1,2)
- VC文件操作:打开文件对话框 OPENFILENAME 代码
- VC 文件操作(文件查找,打开/保存,读/写,复制/删除/重命名)
- Java基础知识之文件操作(二)——IO流复制文件