A utility class that provides static functions for file operations.
More...
#include <sttnet_English.h>
|
| static bool | createDir (const std::string &ddir, const mode_t &mode=0775) |
| | Create a new directory. More...
|
| |
| static bool | copy (const std::string &sourceFile, const std::string &objectFile) |
| | Copy a file. More...
|
| |
| static bool | createFile (const std::string &filePath, const mode_t &mode=0666) |
| | Create a new file. More...
|
| |
| static size_t | get_file_size (const std::string &fileName) |
| | Get the size of a file. More...
|
| |
A utility class that provides static functions for file operations.
| static bool stt::file::FileTool::copy |
( |
const std::string & |
sourceFile, |
|
|
const std::string & |
objectFile |
|
) |
| |
|
static |
Copy a file.
- Parameters
-
| sourceFile | The path of the source file, which can be an absolute or relative path. |
| objectFile | The path of the target file, which can be an absolute or relative path. |
- Returns
- true if the operation is successful.
-
false if the operation fails.
- Note
- Non-existent paths will not be created automatically.
| static bool stt::file::FileTool::createDir |
( |
const std::string & |
ddir, |
|
|
const mode_t & |
mode = 0775 |
|
) |
| |
|
static |
Create a new directory.
- Parameters
-
| ddir | The directory path, which can be an absolute or relative path. |
| mode | A bit mask representing the permissions of the newly created directory (default is 0775, i.e., rwx rwx r-x). |
- Returns
- true if the operation is successful.
-
false if the operation fails.
| static bool stt::file::FileTool::createFile |
( |
const std::string & |
filePath, |
|
|
const mode_t & |
mode = 0666 |
|
) |
| |
|
static |
Create a new file.
- Parameters
-
| filePath | The file path, which can be an absolute or relative path. |
| mode | A bit mask representing the permissions of the newly created file (default is 0666, i.e., rw- rw- rw-). |
- Returns
- true if the operation is successful.
-
false if the operation fails.
- Note
- Non-existent paths will be created automatically.
| static size_t stt::file::FileTool::get_file_size |
( |
const std::string & |
fileName | ) |
|
|
static |
Get the size of a file.
- Parameters
-
| fileName | The name of the file (can be an absolute or relative path). |
- Returns
- >=0 Returns the file size.
-
-1 Failed to get the file size.
The documentation for this class was generated from the following file: