576
Appendix A: System Routines — Files
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
FStatus
Declaration:
WORD
FStatus
(FILES *
fsPtr
)
Category(ies):
Files
Description:
Return the status of a file. FS_OK if no errors have occurred or
FS_ERROR if any errors have occurred. Note that errors accumulate so
that multiple writes may be done on a file as long as the status is checked
after the last write. The only way to clear the status is to close the file.
Inputs:
fsPtr
— Pointer to FILES structure previously opened with
FOpen
.
Outputs:
FS_OK or FS_ERROR.
Assumptions:
None
Side Effects:
None
Availability:
On AMS 2.00 and higher.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: FOpen, FClose, FWrite, FPutC
Example:
FILE f1;
if (FS_OK == FOpen("APPDATA", &f1, FM_WRITE, "EXT" )) {
for( int i = 1; i <= 200; i++)
FPutC( i, &f1 );
FWrite( "123456", 6, &f1 );
if (FS_OK != FStatus( &f1 )) {
/* One of the FPutC calls or the FWrite ran out of memory */
FClose( &f1 );
Disp("ERROR writing to file");
FDelete( "APPDATA" ); /* only have partial file */
return;
}
FClose( &f1 ); /* all writes were successful */
}