# FSFile

## C Specification

      #include <nitro/fs.h>

      /* file and directory structure */

      typedef struct FSFile
      {
      /* private: */
      	/* for archive control */
      	FSFileLink          link;
      	struct  FSArchive   *arc;
      	/* for internal status */
      	u32                 stat;
      	FSCommandType       command;
      	FSResult            error;
      	OSThreadQueue       queue[4 / sizeof(OSThreadQueue)];
      /* private: (except direct operation with FSArchive) */
      	/* handle property */
      	union {
      		/* file-handle property */
      		struct {
      			u32           own_id; /* own file-id */
      			u32           top;    /* image-top */
      			u32           bottom; /* image-bottom */
      			u32           pos;    /* current position */
      		} file;
      		/* directory-handle property */
      		struct {
      			FSDirPos      pos;    /* current-directory-position */
      			u32           parent; /* parent directory-id */
      		} dir;
      	} prop;
      	/* command argument and return value area */
      	union {
      		FSReadFileInfo        readfile;
      		FSWriteFileInfo       writefile;
      		FSSeekDirInfo         seekdir;
      		FSReadDirInfo         readdir;
      		FSFindPathInfo        findpath;
      		FSGetPathInfo         getpath;
      		FSOpenFileFastInfo    openfilefast;
      		FSOpenFileDirectInfo  openfiledirect;
      		FSCloseFileInfo       closefile;
      	} arg;
      } FSFile;

## Description

This structure is used by file and directory access functions.
All of the elements are used exclusively for internal processes. Direct manipulation of these elements is prohibited.

Cautions
Future extensions may change the expressions in this type.
Avoid programming that is dependent on the sizes or elements that are in the current implementation.

## See Also

`FS_OpenFile, FS_OpenFileFast, FS_CloseFile, FS_GetLength, FS_ReadFile, FS_SeekFile, FS_SeekFileToBegin, FS_SeekFileToEnd, FS_FindDir, FS_ReadDir, FS_TellDir, FS_SeekDir, FS_RewindDir`

## Revision History

11/02/2004 Corrected the structure definition to match the header file.
05/20/2004 Description changes due changes in `FSFile`.
05/14/2004 Description changes due changes in `FSFile`.
04/13/2004 Description changes due changes in `FSFile`.
04/08/2004 Description changes due to the integration of `FSDir` and `FSFile`.
04/01/2004 Initial version.