Difference between revisions of "CLOSE"

From QB64 Wiki
Jump to navigation Jump to search
m (Text replacement - "{{Parameters}}" to "{{PageParameters}}")
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''CLOSE''' closes an [[OPEN]] file.
+
[[CLOSE]] closes an open file or port using the number(s) assigned in an [[OPEN]] statement.
  
''Useage 1:'' CLOSE can close individual files by using the OPEN filenumber:
 
  
''Example 1:'' CLOSE #2
+
{{PageSyntax}}
 +
: [[CLOSE]] [{{Parameter|fileNumber}}[, ...]]
  
''Useage 2:'' CLOSE can close a few files by using a few filenumbers:
 
  
''Example 2:'' CLOSE #1, #2, #3
+
{{PageParameters}}
 +
* {{Parameter|fileNumber}} indicates the file or list of file numbers to close. When not specified, all open files are closed.
  
''Useage 3:'' CLOSE can close all OPEN files:
 
  
''Example 3:'' CLOSE
+
{{PageDescription}}
 +
* A file must be closed when changing to another file mode.
 +
* [[CLOSE]] files when they are no longer needed, in order to save memory.
 +
* Files cannot be opened in the same [[OPEN]] mode using another number until the first one is closed.
 +
* Use holding variables for each file number returned by [[FREEFILE]] so that the file reference is known.
 +
* Will not return an error if a filenumber is already closed or was never opened. It does not verify that a file was closed.
 +
* [[CLEAR]] can be used to close all open files.
 +
* [[CLOSE]] can also be used to close an open TCP/IP connection using a handle returned by '''QB64'''.
 +
 
 +
 
 +
{{PageSeeAlso}}
 +
* [[OPEN]], [[OPEN COM]]
 +
* [[_OPENCLIENT]], [[_OPENHOST]]
 +
* [[_OPENCONNECTION]]
 +
* [[_SNDCLOSE]]
 +
 
 +
 
 +
{{PageNavigation}}

Latest revision as of 12:41, 17 February 2021

CLOSE closes an open file or port using the number(s) assigned in an OPEN statement.


Syntax

CLOSE [fileNumber[, ...]]


Parameters

  • fileNumber indicates the file or list of file numbers to close. When not specified, all open files are closed.


Description

  • A file must be closed when changing to another file mode.
  • CLOSE files when they are no longer needed, in order to save memory.
  • Files cannot be opened in the same OPEN mode using another number until the first one is closed.
  • Use holding variables for each file number returned by FREEFILE so that the file reference is known.
  • Will not return an error if a filenumber is already closed or was never opened. It does not verify that a file was closed.
  • CLEAR can be used to close all open files.
  • CLOSE can also be used to close an open TCP/IP connection using a handle returned by QB64.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page