%CLOSE

%CLOSE


%CHOWN Index Level %CONNECT
Syntax variable = %CLOSE( file.descriptor )
Category BASIC
Type C Function
Description closes the Unix file specified by "file.descriptor" returned by a previous call to %open(), %creat(), %dup(), %socket() or %accept().

All Unix files opened from a FlashBASIC program are closed automatically at main program termination. It is a safe practice, though, to close files explicitly.
Options
See Also %CREAT %DUP c function CFUNCTION %TTYNAME %UNLINK %OPEN %SOCKET %ACCEPT %CONNECT %FSIZE %LISTEN
Example 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.
Warnings Closing one of the system files (stdin, stdout, etc.) has unpredictable results.
Compatibility D3/Unix
%CHOWN Index Level %CONNECT