The %close() function closes the UNIX file specified by file.descriptor returned by a previous call to %open(), %creat(), %dup(), %socket(), or %accept().
All host OS files opened from a FlashBASIC program are closed automatically at main program termination. However, it is a safe practice to close files explicitly.
NOTE |
You must use %socketclose if attempting to close a socket file descriptor in Windows. |
Syntax
var = %close(file.descriptor) |
CAUTION |
Closing one of the system files (stdin, stdout, and so on) has unpredictable results. |
Example(s)
if %close(fd) then crt ’Cannot close file’ stop end |
Note the use of the implicit (void) casting by not including the statement as part of an assignment. The return code of the close is thrown away.
See Also