This file provides file manipulation functions.
More...
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
◆ file_open()
| int32_t file_open |
( |
const char * |
pathname, |
|
|
uint32_t |
mode |
|
) |
| |
Function to get handle of open device
- Parameters
-
| pathname | File path |
| mode | file mode |
- Returns
- file descriptor
◆ file_close()
| int32_t file_close |
( |
int32_t |
fd | ) |
|
Function to close file
- Parameters
-
- Returns
- error code of operation
◆ file_read()
| int32_t file_read |
( |
int32_t |
fd, |
|
|
void * |
buff, |
|
|
size_t |
btr |
|
) |
| |
Function to read data from file given by handle
- Parameters
-
| fd | File descriptor |
| buff | buffer pointer |
| btr | bytes to be read |
- Returns
- bytes read
◆ file_write()
| int32_t file_write |
( |
int32_t |
fd, |
|
|
void * |
buff, |
|
|
size_t |
cnt |
|
) |
| |
Function to write data to file given by handle
- Parameters
-
| fd | File descriptor |
| buff | buffer pointer |
| cnt | bytes to be written |
- Returns
- bytes writen
◆ file_seek()
| int32_t file_seek |
( |
int32_t |
fd, |
|
|
size_t |
offset |
|
) |
| |
Function to seek in given by handle
- Parameters
-
| fd | File descriptor |
| offset | from start of the file |
- Returns
- error code of operation
◆ file_getsize()
| int32_t file_getsize |
( |
int32_t |
fd | ) |
|
Function to get the device file size.
- Parameters
-
- Returns
- size of file in bytes
◆ file_exists()
| bool file_exists |
( |
const char * |
filename | ) |
|
Returns true if the given file exists on disk and false if not
- Parameters
-
| filename | Name and path of the file to test for existence |
- Returns
- true or false
◆ dir_exists()
| bool dir_exists |
( |
const char * |
dirname | ) |
|
Returns true if the given directory exists on disk and false if not
- Parameters
-
| dirname | Name and path of the directory to test for existence |
- Returns
- true or false