fsFileStatus (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Firmware version:

1.00 / 1.00.00


This function will return the status on the specified FILE after it has been opened or created.

 

 

Input:

fd : FILE

FILE descriptor for the file retrieved from fsFileOpen or fsFileCreate .

 

Returns: INT

0

- File is open and ready for use.

-1

- Media not open.

-7

- Media is full.

-8

- File is not open.

-16

- Media not present.

-17

- Media communication error (card not supported).

-22

- Media is busy.

-23

- Media is write protected.

-24

- Unknown file system.

-33

- Too many files open.

-38

- File is no longer accessible and must be closed.

 

Declaration:

FUNCTION fsFileStatus : INT;
VAR_INPUT
   fd : FILE;
END_VAR;

 

 

Example:

...
IF fsFileExists(name := "gpslog.dat") THEN
   fd := fsFileOpen(name := "gpslog.dat");
ELSE
   fd := fsFileCreate(name := "gpslog.dat");
END_IF;
IF fsFileStatus(fd := fd) = 0 THEN
   // File open, write data
   ...
   fsFileWrite(fd := fdbuffer := ADDR(gps.latitude), length := SIZEOF(gps.latitude));
   fsFileWrite(fd := fdbuffer := ADDR(gps.longitude), length := SIZEOF(gps.longitude));
   ...
   fsFileClose(fd := fd);
ELSE
   // Error when opening/creating file
   ...
END_IF;
...