windows CopyFile的正确输入格式是什么
What is the correct input format for windows CopyFile?
我正在尝试使用windows CopyFile函数复制一个文件,并将其重命名为其他文件夹中的另一个文件。然而,它总是返回路径有问题,即使我给它的路径是正确的,并且文件和文件夹都存在。我做错了什么?
使用"C:\Dummy.png"作为源,使用"C:\Dest"作为目标。
void CreateDummyItemsAssetsPNG()
{
string DummyAsset;
string dummyDestination;
cout<<"Please Provide dummy file asset that is a .png: ";
cin>>DummyAsset;
cout<<"Please Provide a Destination: ";
cin>>dummyDestination;
vector<string>::iterator itor;
string fullDest;
for(itor = listOfItems.begin(); itor<listOfItems.end(); ++itor)
{
fullDest.clear();
fullDest = dummyDestination + "\"+ (*itor)+".png";
cout<<"Copy: "<<DummyAsset<<" TO: "<<fullDest<<endl;
if(!CopyFile(LPCTSTR(DummyAsset.c_str()),LPCTSTR(dummyDestination.c_str()),false) )
{
printf("Could not copy file.n");
cout<<GetLastError()<<endl;
}
}
}
谢谢!
CopyFile()
需要一个文件名称作为第二个参数,而您只传递目标目录。指定全名(您似乎在fullDest
中这样做),这应该会起作用。
相关文章:
- 将信息输入到下面显示的结构向量中的正确语法/格式是什么
- C++ 我的开关格式中的循环不允许我显示菜单选项或接受输入?
- 如何检查程序员在C++中提供的两种不同格式的输入
- 如何为输入设置变量编号和__android_log_print格式
- 如何使用正则表达式将输入数字格式化为字符串
- 此功能希望从std :: istream解析该功能的输入格式
- 检查leandit输入是否具有正确的格式QT 5 C
- C++ 用户输入的字符串必须采用 DD-MM-YYYY 格式
- 如何提示用户在C++中输入正确的电子邮件地址格式
- 如何在 c++ 中从".in"格式的文件中获取输入?此代码进入无限循环,但适用于".txt"文件格式
- cvPreparePredictData中不支持的格式或格式组合(输入样本必须具有32fC1类型)
- (C )以Specfic格式从用户中获取输入
- 如何将GUI用户字符串输入转换为使用C++库函数的格式
- 使用boost::propertytree为我的代码输入文件格式
- push_back opencv中输入参数的格式不匹配
- windows CopyFile的正确输入格式是什么
- 以mm/dd/yyyy格式输入日期,并将其拆分为3个单独的变量
- 二维数组C++中的输入格式
- 如何将用户输入格式化为整洁的表格,以便在C++中输出
- C++窗口窗体:如何在文本框中控制用户输入格式