Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

CLOSE

Description

The CLOSE command can be used to close files, TCP network connections and UDP channels. CLOSE can be called with either zero or one argument. If no argument given, CLOSE closes all open files but keep network connections open. If an argument is given, it must be a handle that refers to an open file, TCP connection or UDP channel.

Example

This example opens an existing file, reads some data, prints it and closes the file after that.

outmode -2
open "R", 1, "test.txt"
if LASTERR = 0 then
   get 1, a$
   print a$
   close 1
   if LASTERR <> 0 then
      print "close failed !!!"
   end if
else
   print "could not open!"
end if

Remarks

CLOSE changes the pseudo-variable LASTERR. If everything woks as expected, LASTERR will be 0 (ERR_OK). Any other value indicates an error. Please see the LASTERR page and also the page describing the OPEN command.