This file provides file manipulation functions.
More...
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
|
#define | FILE_ENABLE_FATFS |
| FatFS enabled.
|
|
#define | FILE_UTILS_NONE 0 |
| No file utils wrapper used.
|
|
#define | FILE_UTILS_FATFS 1 |
| FatFS file utils wrapper used.
|
|
#define | FILE_UTILS_SEMI 2 |
| Semihosting file utils wrapper used.
|
|
#define | FILE_UTILS_FS_SEL FILE_UTILS_FATFS |
| Selection of file system.
|
|
#define | FILE_FS_TABLE_SIZE 1u |
| Maximal number of open files.
|
|
#define | FILE_RDONLY 0x01u |
| File access mode read only.
|
|
#define | FILE_WRONLY 0x02u |
| File access mode write only.
|
|
#define | FILE_RDWR 0x04u |
| File access mode read write.
|
|
#define | FILE_APPEND 0x08u |
| File access mode append.
|
|
#define | FILE_CREAT 0x10u |
| File access mode create.
|
|
#define | FILE_TRUNC 0x20u |
| File access mode create and truncates it to 0.
|
|
|
int32_t | file_open (const char *pathname, uint32_t mode) |
| file_open
|
|
int32_t | file_close (int32_t fd) |
| file_close
|
|
int32_t | file_read (int32_t fd, void *buff, size_t btr) |
| file_read
|
|
int32_t | file_write (int32_t fd, void *buff, size_t cnt) |
| file_write
|
|
int32_t | file_seek (int32_t fd, size_t offset) |
| file_seek
|
|
int32_t | file_getsize (int32_t fd) |
| file_getsize
|
|
bool | file_exists (const char *filename) |
| file_exists
|
|
bool | dir_exists (const char *dirname) |
| dir_exists
|
|
◆ 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