从PC拷贝文件到磁盘

void CWindowOperate::CopyFileToDisk(const CString csPcFilePath, const CString csDiskFilePath)
{
 char pFrom[MAX_PATH] = {0};
 char pTo[MAX_PATH] = {0};
 int strLength = csPcFilePath.GetLength() + 1;
 strncpy(pFrom, csPcFilePath, strLength);
 strLength = csDiskFilePath.GetLength() + 1;
 strncpy(pTo, csDiskFilePath, strLength);

 SHFILEOPSTRUCT FileOp={0};
 FileOp.hwnd = NULL;
 FileOp.fFlags = FOF_NOCONFIRMATION|   //不出现确认对话框
  FOF_NOCONFIRMMKDIR ; //需要时直接创建一个文件夹,不需用户确定
 FileOp.pFrom = pFrom;
 FileOp.pTo = pTo;
 FileOp.wFunc = FO_COPY;
 SHFileOperation(&FileOp);
}

你可能感兴趣的:(从PC拷贝文件到磁盘)