Configuring a File Buffer

The file module has functions to assign and flush a file buffer that are equivalents to POSIX API functions (see Listing - File Module Function and Listing - POSIX API Equivalent); the primary difference is the advantage of valuable return error codes to the application.

Listing - File Module Function
void FSFile_BufAssign (FS_FILE    *p_file,
                       void       *p_buf,
                       FS_FLAGS    mode,
                       CPU_SIZE_T  size,
                       FS_ERR     *p_err);
 
void FSFile_BufFlush (FS_FILE  *p_file,
                      FS_ERR   *p_err);
Listing - POSIX API Equivalent
int fs_setvbuf (FS_FILE   *stream,
                char      *buf,
                int        mode,
                fs_size_t  size);


 int fs_fflush (FS_FILE  *stream);

For more information about and an example of configuring a file buffer, see Configuring a File Buffer - POSIX.