Embedded TCP/IP stack: fnet_fs_fopen_re

FNET

fnet_fs_file_t fnet_fs_fopen_re ( const fnet_char_t filename,
const fnet_char_t mode,
fnet_fs_dir_t  dir 
)

Opens a file relatively in an opened directory.

Parameters
filenameFile pathnamem, which is relative to the dir directory (null-terminated string).
modeString containing a file access modes. It can be:
  • "r" = open a file for reading. The file must exist.
  • "w" = create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.

    The current version of FS API des not support this mode.
  • "a" = append to a file. Writing operations append data at the end of the file. The file is created if it does not exist.

    The current version of FS API des not support this mode.
  • "r+" = open a file for update for both reading and writing. The file must exist.

    The current version of FS API does not support this mode.
  • "w+" = create an empty file for both reading and writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.

    The current version of FS API does not support this mode.
  • "a+" = open a file for reading and appending. All writing operations are performed at the end of the file. The initial file position for reading is at the beginning of the file, but output is always appended to the end of the file. The file is created if it does not exist.

    The current version of FS API does not support this mode.
dirDirectory descriptor.
Returns
This function returns:
  • File descriptor if no error occurs.
  • 0 if an error occurs.
See also
fnet_fs_fopen(), fnet_fs_fclose()

This function opens the file whose pathname is specified by the filename, which is relative to the directory dir, and associates it with a returned file descriptor.
The operations that are allowed on the file and how these are performed are defined by the mode parameter.
NOTE: The current version of FS API supports the reading mode only.


© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net