如何使用升压::文件系统COPY_FILE? [英] How to use copy_file in boost::filesystem?

查看:124
本文介绍了如何使用升压::文件系统COPY_FILE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将文件从目录复制到另一个,但我的程序总是中止了这样做在此之前能告诉我什么是错的一些reasons.Has人?我怎么能捕获异常是由 COPY_FILE 抛出,我检查提振网站,但我无法找到任何异常的相关信息。

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 );

谢谢,

推荐答案

您必须提供的文件名的路径,而不仅仅是目录它驻留在

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

这篇关于如何使用升压::文件系统COPY_FILE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆