FS_FILE *FSFile_Open (CPU_CHAR *name_full,
FS_FLAGS mode
FS_ERR *p_err);
File |
Called from |
Code enabled by |
|
Application;
|
N/A |
Open a file.
See fs_fopen()
for more information.
Arguments
name_full
Name of the file. See section 4-3 “μC/FS File and Directory Names and Paths” for information about file names.
mode
File access mode (see Notes #1 and #2).
p_err
Pointer to variable that will the receive return error code from this function:
FS_ERR_NONE
File opened.
FS_ERR_NAME_NULL
Argument name_full
passed a NULL pointer.
Or entry error (see Section B.04).
Returned Value
None.
Notes/Warnings
FS_FILE_ACCESS_MODE_RD
File opened for reads.
FS_FILE_ACCESS_MODE_WR
File opened for writes.
FS_FILE_ACCESS_MODE_CREATE
File will be created, if necessary.
FS_FILE_ACCESS_MODE_TRUNC
File length will be truncated to 0.
FS_FILE_ACCESS_MODE_APPEND
All writes will be performed at EOF.
FS_FILE_ACCESS_MODE_EXCL
File will be opened if and only if it does not already exist.
FS_FILE_ACCESS_MODE_CACHED
File data will be cached.
FS_FILE_ACCESS_MODE_TRUNC
is set, then FS_FILE_ACCESS_MODE_WR
must also be set.FS_FILE_ACCESS_MODE_EXCL
is set, then FS_FILE_ACCESS_MODE_CREATE
must also be set.FS_FILE_ACCESS_MODE_RD
and/or FS_FILE_ACCESS_MODE_WR
must be set.fs_fopen()
function can specify a subset of the possible valid modes for this function. The equivalent modes of fs_fopen()
mode strings are shown in Table 5-4.
fopen() Mode String |
mode Equivalent |
“r” or “rb” |
|
“w” or “wb” |
|
“a” or “ab” |
|
“r+” or “rb+” or “r+b” |
|
“w+” or “wb+” or “w+b” |
|
“a+” or “ab+” or “a+b” |
|
Table A-1 fs_fopen() mode strings and mode equivalents.