# FS_FILEMODE_*

## Definition

    #define FS_FILEMODE_R               0x00000001UL
    #define FS_FILEMODE_W               0x00000002UL
    #define FS_FILEMODE_L               0x00000004UL
    #define FS_FILEMODE_RW              (FS_FILEMODE_R | FS_FILEMODE_W)
    #define FS_FILEMODE_RWL             (FS_FILEMODE_R | FS_FILEMODE_W | FS_FILEMODE_L)

## Description

Constants used if specifying the access mode when opening a file or directory using the file system API.

FS_FILEMODE_R | Requests only read access.
FS_FILEMODE_W | Requests only write access. If the file already exists, its contents will be wiped out, and a new file of size 0 will be created.
FS_FILEMODE_RW | Requests both read and write access.

FS_FILEMODE_RWL

Requests both read and write access, but changes to the file size after the file is opened will be prohibited, and the following internal checks will be enabled automatically.

- Operations that use `FS_WriteFile()` to add to the file after the terminator will be suppressed. When called at the terminator, it will return 0.
- Operations that use `FS_SetFileLength()` to change the size will always fail and return FS_RESULT_PERMISSION_DENIED.

## See Also

`FS_OpenFileEx
FS_OpenDirectory`

## Revision History

2008/04/17 Added details for each option.
2008/04/14 Added the `FS_FILEMODE_L` option.
2007/09/18 Initial version.

CONFIDENTIAL