Helper functions about file handling.
More...
#define VTM_FILE_ATTR_REG 1 |
#define VTM_FILE_ATTR_DIR 2 |
VTM_API uint64_t vtm_file_get_fsize |
( |
FILE * |
fp | ) |
|
Determines the file size.
- Returns
- the file size in bytes
VTM_API int vtm_file_getline |
( |
FILE * |
fp, |
|
|
char ** |
buf, |
|
|
size_t * |
buf_len |
|
) |
| |
Reads one line delimited by \n from file.
The same buffer can be used in subsequent reads. The buffer is resized if more space is needed.
- Parameters
-
| fp | the file where to read from |
[in,out] | the | allocated buffer with line content |
[in,out] | size | of the buffer |
- Returns
- VTM_OK if read of line was successful
-
VTM_E_IO_EOF when end of file is reached
VTM_API const char* vtm_file_get_ext |
( |
const char * |
filename | ) |
|
Determines the extension of the given filename.
- Returns
- pointer to extension in in input string
-
NULL if file has no extension
VTM_API int vtm_file_get_fattr |
( |
FILE * |
fp, |
|
|
int * |
attr |
|
) |
| |
Reads the attributes of given file.
- Parameters
-
| fp | the file where to read from |
[out] | attr | attributes are stored here |
- Returns
- VTM_OK if attributes were read successfuully
-
VTM_E_IO_UNKNOWN if an error occured