45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
#include <iostream>
|
|
#include <vector>
|
|
|
|
namespace CVrFileUtils
|
|
{
|
|
/// 文件是否存在
|
|
bool IsFileExist(const char* pFileName);
|
|
|
|
/// 文件大小
|
|
size_t GetFileSize(const char* fileName);
|
|
|
|
/// 写文件
|
|
bool WriteFileData(const char* pFileName, const char* pData, const size_t nLen, bool isAppend = false);
|
|
|
|
/// 读文件
|
|
bool ReadFileData(const char* pFileName, char* pData, size_t* pLen, const int nOffset = 0);
|
|
|
|
/// 获取目录下所有的文件
|
|
bool GetFileList(std::string& pDirPath, std::string exd, std::vector<std::string>& vetFiles);
|
|
|
|
/// 获取目录下所有目录
|
|
bool GetDirList(std::string& pDirPath, std::vector<std::string>& vetFiles);
|
|
|
|
/// 文件重命名
|
|
bool ReNameFile(const char* oldName, const char* newName);
|
|
|
|
/// 删除文件
|
|
bool DeleteLocalFile(const char* sFileName);
|
|
|
|
/*******目录操作*******/
|
|
/// 目录是否存在
|
|
bool IsDirExist(const char* szDirectory);
|
|
|
|
/// 创建新的文件夹
|
|
bool CreatNewDir(const char* szPath);
|
|
|
|
/// 删除目录
|
|
bool DeleteDir(const char* szDirPath);
|
|
|
|
/// 去除后缀获取文件名称
|
|
std::string GetFileName(const std::string& filePath, bool bHasSuffix = true);
|
|
|
|
} // namespace name
|