[英]Trouble understanding boost copy_file “File exists” error message
我正在調查程序中出現以下錯誤消息的問題:
boost::fs: boost::filesystem::copy_file: File exists: "path/to/file1", "path/to/file2" path1="path/to/file1" path2="path/to/file2"
我猜問題是某些文件已經存在,並且無法覆蓋它,但是我不確定到底是哪個文件。
是無法復制到path/to/file2
file1
還是相反的文件? 還是完全其他?
增強文檔在這里說以下內容:
void copy_file(const path& from, const path& to);
void copy_file(const path& from, const path& to,
system::error_code& ec);
void copy_file(const path& from, const path& to,
copy_option option);
void copy_file(const path& from, const path& to,
copy_option option, system::error_code& ec);
另外,您可以使用以下方法檢查文件是否存在:
if ( !boost::filesystem::exists( "myfile.txt" ) )
{
std::cout << "Can't find my file!" << std::endl;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.