当前位置: 首页 > news >正文

文件操作,涉及CFileFind ,CFileDialog CFile 类的操作。

///完成的功能是:把源目录下的文件拷贝到目标目录下面。

void CBackUpFilesDlg::BackFiles(CString soureFiles,CString detinFiles)

{

    CFileFind find;

CString   strPathFiles = soureFiles;

CStringArray strFileArray;

int bFind=0;

if ( strPathFiles.Right(1) != "//" )

strPathFiles += "//";

strPathFiles += "*.*";

 

bFind = find.FindFile( strPathFiles );

 

while ( bFind )

{

bFind = find.FindNextFile();

   strFileArray.Add(find.GetFileName());

}

 

int count=strFileArray.GetSize();

int i=0;

///遍历数组,拷贝到目标目录

for(i=2;i<count;i++)

{

/*LPCTSTR pointerSource=(LPCTSTR)strPathFiles[i]

        LPCTSTR pointerDestin=(LPCTSTR)strPathFiles[i];

CopyFile(pointerSource,pointerDestin,false);*/

CString sourceFile=(CString)strFileArray[i];

CString sourceFileName= this->m_CString_Source+"//"+sourceFile;

CString destinFileName=this->m_CString_Destin+"//"+sourceFile;

BOOL isCopySuccess=false;

isCopySuccess=CopyFile(sourceFileName,destinFileName,

 

///CFileDialog 的使用

 

CFileDialog fileDialog(true);

fileDialog.DoModal();

CString fileFullPath=fileDialog.GetPathName();

CString fileName=fileDialog.GetFileName();

int fullpathLength=fileFullPath.GetLength();

int fileNameLength=fileName.GetLength();

   fileFullPath.Delete(fullpathLength-fileNameLength-1,fileNameLength+1);

this->m_CString_Source=fileFullPath;

this->m_CEdit_Source.SetSel(0,-1);

this->m_CEdit_Source.ReplaceSel(this->m_CString_Source);

相关文章:

  • 不同线程操作控件
  • c#关键字,ref和out
  • PowerDesigner 15 反向生成PDM
  • 限制线程的执行个数
  • 线程服务的停止与启动
  • 生产者,消费者线程
  • 单实例运行程序
  • play framework系列之maven 构建
  • python tcp 实时抓包
  • 个人支付平台
  • Android 程序分析环境搭建-开发环境搭建
  • 分析Android APK-反编译修改打包
  • Android 程序分析环境搭建-静态分析环境搭建
  • 某盟逆向初步
  • Frida 基本安装配置
  • 11111111
  • ECMAScript入门(七)--Module语法
  • iOS | NSProxy
  • JavaScript 事件——“事件类型”中“HTML5事件”的注意要点
  • JavaScript实现分页效果
  • Mithril.js 入门介绍
  • 多线程事务回滚
  • 高性能JavaScript阅读简记(三)
  • 坑!为什么View.startAnimation不起作用?
  • 无服务器化是企业 IT 架构的未来吗?
  • 译自由幺半群
  • 数据可视化之下发图实践
  • #大学#套接字
  • (145)光线追踪距离场柔和阴影
  • (C语言)strcpy与strcpy详解,与模拟实现
  • (zt)基于Facebook和Flash平台的应用架构解析
  • (待修改)PyG安装步骤
  • (二)学习JVM —— 垃圾回收机制
  • (附源码)ssm教师工作量核算统计系统 毕业设计 162307
  • (九十四)函数和二维数组
  • (四)c52学习之旅-流水LED灯
  • (转)Oracle 9i 数据库设计指引全集(1)
  • (转)全文检索技术学习(三)——Lucene支持中文分词
  • .NET Standard / dotnet-core / net472 —— .NET 究竟应该如何大小写?
  • .net 按比例显示图片的缩略图
  • .NET 除了用 Task 之外,如何自己写一个可以 await 的对象?
  • .net 简单实现MD5
  • .net程序集学习心得
  • .net反编译工具
  • .NET简谈互操作(五:基础知识之Dynamic平台调用)
  • .NET中使用Protobuffer 实现序列化和反序列化
  • @javax.ws.rs Webservice注解
  • [20181219]script使用小技巧.txt
  • [AutoSar NVM] 存储架构
  • [BUUCTF]-PWN:wustctf2020_number_game解析(补码,整数漏洞)
  • [BUUCTF]-Reverse:reverse3解析
  • [CTF]php is_numeric绕过
  • [HOW TO]如何在iPhone应用程序中发送邮件
  • [InnoDB系列] -- SHOW INNODB STATUS 探秘
  • [LeetCode]Reverse Linked List II