在cpp文件中是否有任何函数可以将整个文件从一个位置复制到另一个位置?) [英] Is there any function in cpp file where we can copy whole file from one location to another?)

查看:116
本文介绍了在cpp文件中是否有任何函数可以将整个文件从一个位置复制到另一个位置?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个文件夹中有一个数据库文件。

我想将数据库文件从一个文件夹移动到任何其他文件夹。



我可以使用任何c ++函数执行此操作,还是必须创建新数据库并将旧数据库复制到其中?

I have a database file in a folder.
I want to move the database file from one folder to any other folder.

Can I do it using any c++ function or do I have to create a new database and copy the old one's content to it?

推荐答案

没有标准的C ++库函数来复制文件。但是这些功能可能由操作系统提供(例如CopyFile [Ex]和MoveFile [Ex] with Windows)或已经使用过的库如Qt。



移动文件可以使用C标准库函数重命名。但是当移动到不同的路径时(取决于操作系统),这可能不起作用。
There is no standard C++ library function to copy a file. But such functions may be provided by the operating system (e.g. CopyFile[Ex] and MoveFile[Ex] with Windows) or by an already used library like Qt.

When moving a file the C standard library function rename can be used. But this may not work when moving to a different path (depends on the operating system).


这篇关于在cpp文件中是否有任何函数可以将整个文件从一个位置复制到另一个位置?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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