How to use copy_file in boost::filesystem?

和自甴很熟 提交于 2019-12-10 12:58:32

问题


I want to copy a file from directory to another, but my program always aborts for some reasons.Has anyone done this this before could tell me what was wrong? And how could I catch exceptions was thrown by copy_file, I checked boost site, but I could not find any relevant information about exception.

path user_path( "C:\\My Folder" );
boost::filesystem::create_directory( user_path );
path file(  "C:\\Another\\file.txt" );
boost::filesystem::copy_file( file, user_path );

Thanks,


回答1:


You have to provide a path to a file name, not just the directory it resides in.



来源:https://stackoverflow.com/questions/4785491/how-to-use-copy-file-in-boostfilesystem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!