Embedded TCP/IP stack  4.7.0

◆ fnet_fs_fopen()

fnet_fs_file_t fnet_fs_fopen ( const fnet_char_t filename,
const fnet_char_t mode 
)

Opens a file descriptor.

Parameters
filenameThe file pathname (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.
Returns
This function returns:
  • File descriptor fnet_fs_file_t if no error occurs.
  • 0 if an error occurs.
See also
fnet_fs_fopen_re(), fnet_fs_fclose()

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


© 2005-2020 by Andrej Butok. http://fnet.sourceforge.net