User`s manual

134 digi.com File Systems
10.1.3 File System API Functions
These functions are defined in FS2.LIB. For more information please see the Dynamic C Function
Reference Manual or from within Dynamic C you can use the Function Lookup feature, with its conve-
nient Ctrl+H shortcut that will take you directly to a function’s description if the cursor is on its name in
the active edit window.
Table 10-1. FS2 API
Command Description
fs_setup (FS2) Alters the initial default configuration.
fs_init (FS2) Initialize the internal data structures for the file system.
fs_format (FS2) Initialize flash and the internal data structures.
lx_format Formats a specified logical extent (LX).
fs_set_lx (FS2) Sets the default LX numbers for file creation.
fs_get_lx (FS2) Returns the current LX number for file creation.
fcreate (FS2) Creates a file and open it for writing.
fcreate_unused (FS2) Creates a file with an unused file number.
fopen_rd (FS2) Opens a file for reading.
fopen_wr (FS2) Opens a file for writing (and reading).
fshift Removes specified number of bytes from beginning of file.
fwrite (FS2) Writes to a file starting at “current position.”
fread (FS2) Reads from the current file pointer.
fseek (FS2) Moves the read/write pointer.
ftell (FS2) Returns the current offset of the file pointer.
fs_sync (FS2)
Flushes any buffers retained in RAM to the underlying
hardware device.
fflush (FS2)
Flushes buffers retained in RAM and associated with the
specified file to the underlying hardware device.
fs_get_flash_lx (FS2)
Returns the LX number of the preferred flash device (the
2nd flash if available).
fs_get_lx_size (FS2) Returns the number of bytes of the specified LX.
fs_get_other_lx (FS2)
Returns LX # of the non-preferred flash (usually the first
flash).
fs_get_ram_lx (FS2) Return the LX number of the RAM file system device.
fclose Closes a file.
fdelete (FS2) Deletes a file.