Skip to main content
Header: ar_osal/api/ar_osal_file_io.h

Functions

ar_fopen

ar_fopen open a file or create if does not exist.
Parameters
ar_fhandle *
Handle to the file.
const char_t *
Absolute file path.
uint32_t
Type of access AR_FILE_OPEN_READ_ONLY AR_FILE_OPEN_WRITE_ONLY AR_FILE_OPEN_READ_WRITE AR_FOPEN_WRITE_ONLY_APPEND AR_FOPEN_READ_WRITE_APPEND AR_FOPEN_READ_ONLY_WRITE
Returns 0 Success Nonzero Failure

ar_fsize

ar_fsize Return file size.
Parameters
ar_fhandle
Handle to the file.
Returns 0 Success Nonzero Failure

ar_fmap

ar_fmap Map a file into Data Memory for Read Only access Whether this allocates heap memory for the buffer or not is platform dependent. On some platforms with low memory this may map non-volatile storage into a readable memory window instead. To free any possible resources allocated by this call, the caller MUST call ar_funmap
Parameters
ar_fhandle
Handle to the file
const void **
A pointer to the read-only Data memory buffer
Returns 0 Success Nonzero Failure

ar_funmap

ar_funmap Un-map a file from Data Memory This call releases a buffer obtained by a previous call to ar_fmap and frees any resources that may be in use by it. The file still needs to be closed by a call to ar_fclose
Parameters
const void *
The pointer to the file buffer obtained by ar_fmap
Returns 0 Success Nonzero Failure

ar_fseek

ar_fseek Move the file pointer for read/write to the required offset.
Parameters
ar_fhandle
Handle to the file.
size_t
The number of bytes to move the file pointer.
ar_fseek_reference_t
Refer to ar_fseek_reference_t for options.
Returns 0 Success Nonzero Failure

ar_fread

ar_fread Read from file.
Parameters
ar_fhandle
Handle to the file.
buf_ptr: Buffer pointer to read data into.
size_t
Data size to read from file.
bytes_read: Actual data size read from file.
Returns 0 Success Nonzero Failure

ar_fwrite

ar_fwrite write to file.
Parameters
ar_fhandle
Handle to the file.
void *
Buffer pointer to write data from.
size_t
Data size to write into file.
bytes_written: Actual data size written into file.
Returns 0 Success Nonzero Failure

ar_fclose

ar_fclose
Parameters
ar_fhandle
Handle to the file.
Returns 0 Success Nonzero Failure

ar_fdelete

ar_fdelete
Parameters
const char_t *
Absolute file path.
Returns 0 Success Nonzero Failure

Type Definitions

ar_fhandle

Structures and Typedefs.

ar_fseek_reference_t

Enumerations

ar_fseek_reference

Values

Macros

AR_FOPEN_READ_ONLY

Opens for reading, file position is at the beginning.

AR_FOPEN_WRITE_ONLY

Opens an empty file for writing.

AR_FOPEN_READ_WRITE

Opens an empty file for both reading and writing.

AR_FOPEN_APPEND

Open for appending (writing at end of file), this parameter alone cannot be used with ar_fopen.

AR_FOPEN_WRITE_ONLY_APPEND

Opens for writing at the end of the file(appending).

AR_FOPEN_READ_WRITE_APPEND

Opens for reading and appending.

AR_FOPEN_READ_ONLY_WRITE

Opens for both reading and writing.