STTNet
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 宏定义 
静态 Public 成员函数 | 所有成员列表
stt::file::FileTool类 参考

提供文件操作的静态函数工具类 更多...

#include <sttnet.h>

类 stt::file::FileTool 继承关系图:
stt::file::File stt::file::LogFile

静态 Public 成员函数

static bool createDir (const std::string &ddir, const mode_t &mode=0775)
 新建一个目录 更多...
 
static bool copy (const std::string &sourceFile, const std::string &objectFile)
 复制文件 更多...
 
static bool createFile (const std::string &filePath, const mode_t &mode=0666)
 新建一个文件 更多...
 
static size_t get_file_size (const std::string &fileName)
 获取文件大小 更多...
 

详细描述

提供文件操作的静态函数工具类

成员函数说明

static bool stt::file::FileTool::copy ( const std::string &  sourceFile,
const std::string &  objectFile 
)
static

复制文件

参数
sourceFile源文件路径,可以绝对路径也可以相对路径
objectFile目标文件路径,可以绝对路径也可以相对路径
返回
true 操作成功
false 操作失败
注解
不会自动创造不存在的路径
static bool stt::file::FileTool::createDir ( const std::string &  ddir,
const mode_t &  mode = 0775 
)
static

新建一个目录

参数
ddir目录路径,可以绝对路径也可以相对路径
mode位掩码表示新建目录的权限(默认为0775 即rwx rwx r-x)
返回
true 操作成功
false 操作失败
static bool stt::file::FileTool::createFile ( const std::string &  filePath,
const mode_t &  mode = 0666 
)
static

新建一个文件

参数
filePath文件路径,可以绝对路径也可以相对路径
mode位掩码表示新建文件的权限(默认为0666 即rw- rw- rw-)
返回
true 操作成功
false 操作失败
注解
会自动创造原本不存在的路径
static size_t stt::file::FileTool::get_file_size ( const std::string &  fileName)
static

获取文件大小

参数
fileName文件名字(可以填绝对路径也可以填相对路径)
返回
>=0 返回文件大小
-1 获取文件大小失败

该类的文档由以下文件生成: