Added UFile::copy()

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@909 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2013-06-18 17:08:37 +00:00
parent 6c656e7c57
commit ffbf4c8ba3
2 changed files with 14 additions and 2 deletions

View File

@@ -57,13 +57,13 @@ long UFile::length(const std::string &filePath)
int UFile::erase(const std::string &filePath)
{
return remove(filePath.c_str());
return std::remove(filePath.c_str());
}
int UFile::rename(const std::string &oldFilePath,
const std::string &newFilePath)
{
return rename(oldFilePath.c_str(), newFilePath.c_str());
return std::rename(oldFilePath.c_str(), newFilePath.c_str());
}
std::string UFile::getName(const std::string & filePath)
@@ -93,3 +93,11 @@ std::string UFile::getExtension(const std::string &filePath)
}
return "";
}
void UFile::copy(const std::string & from, const std::string & to)
{
std::ifstream src(from.c_str());
std::ofstream dst(to.c_str());
dst << src.rdbuf();
}