AXCEL C++ Framework
Elegance through abstraction
|
File system. More...
Classes | |
class | file |
File. More... | |
Functions | |
timer | fatime (const char *fname) |
Get file access time. | |
timer | fmtime (const char *fname) |
Get file modification time. | |
bool | mv (const char *src, const char *dst) |
Move file. | |
bool | cp (const char *src, const char *dst) |
Copy file. | |
string | gcd () |
Get current directory. | |
string | ls (const char *dir=0) |
List files. | |
size_t | fread (const char *fname, char *buf, size_t len=0) |
Read from file. | |
string | fread (const char *fname, size_t len=0) |
Read from text file. | |
size_t | fwrite (const char *fname, const char *buf, size_t len=0) |
Write to file. | |
size_t | fcat (const char *fname, const char *buf, size_t len=0) |
Concatenate to file. | |
bool | fcmp (const char *src, const char *dst) |
Compare files. | |
bool | md (const char *path) |
Make directory. | |
bool | cd (const char *path) |
Change current directory. | |
bool | creat (const char *fname) |
Create file. | |
bool | trunc (const char *fname, unsigned long len) |
Resize file. | |
bool | rm (const char *fname) |
Remove file. | |
bool | rd (const char *dir, bool rmsub=1) |
Remove directory. | |
size_t | fsize (const char *fname) |
Get file size. | |
bool | fexist (const char *fname) |
Check if file exists. | |
bool | fisdir (const char *fname) |
Check if file is directory. | |
bool | fisreg (const char *fname) |
Check if file is regular file. | |
data | fbread (const char *fname, size_t len=0) |
Read binary data from file. | |
size_t | fbwrite (const char *fname, data d, size_t len=0) |
Write binary data to file. | |
string | tmpnam () |
Generate temporary filename. |
File system.
bool axcel::fs::cd | ( | const char * | path | ) |
bool axcel::fs::cp | ( | const char * | src, |
const char * | dst | ||
) |
bool axcel::fs::creat | ( | const char * | fname | ) |
timer axcel::fs::fatime | ( | const char * | fname | ) |
data axcel::fs::fbread | ( | const char * | fname, |
size_t | len = 0 |
||
) |
size_t axcel::fs::fbwrite | ( | const char * | fname, |
data | d, | ||
size_t | len = 0 |
||
) |
size_t axcel::fs::fcat | ( | const char * | fname, |
const char * | buf, | ||
size_t | len = 0 |
||
) |
bool axcel::fs::fcmp | ( | const char * | src, |
const char * | dst | ||
) |
bool axcel::fs::fexist | ( | const char * | fname | ) |
bool axcel::fs::fisdir | ( | const char * | fname | ) |
bool axcel::fs::fisreg | ( | const char * | fname | ) |
timer axcel::fs::fmtime | ( | const char * | fname | ) |
string axcel::fs::fread | ( | const char * | fname, |
size_t | len = 0 |
||
) |
size_t axcel::fs::fread | ( | const char * | fname, |
char * | buf, | ||
size_t | len = 0 |
||
) |
size_t axcel::fs::fsize | ( | const char * | fname | ) |
size_t axcel::fs::fwrite | ( | const char * | fname, |
const char * | buf, | ||
size_t | len = 0 |
||
) |
string axcel::fs::gcd | ( | ) |
string axcel::fs::ls | ( | const char * | dir = 0 | ) |
List files.
dir | Directory to list |
List files/folders in directory dir. If dir is not specified, the current directory is used. The string returned contains each file/folder in the directory delimited by a '\n' character.
bool axcel::fs::md | ( | const char * | path | ) |
bool axcel::fs::mv | ( | const char * | src, |
const char * | dst | ||
) |
bool axcel::fs::rd | ( | const char * | dir, |
bool | rmsub = 1 |
||
) |
Remove directory.
dir | Relative or absolute path of folder |
rmsub | Recursively remove or only remove if empty |
If rmsub is true, then this function recursively deletes all child files and folders. If rmsub is false, this function only removes the specified directory if it is empty.
bool axcel::fs::rm | ( | const char * | fname | ) |
string axcel::fs::tmpnam | ( | ) |
bool axcel::fs::trunc | ( | const char * | fname, |
unsigned long | len | ||
) |
Resize file.
fname | Absolute or relative pathname of file |
len | New length of file in bytes |
Cause the regular file named by fname to be truncated to a size of precisely len bytes. If the file previously was larger than this size, the extra data is lost. If the file previously was shorter, it is extended, and the extended part reads as null bytes ('\0').