Difference between revisions of "OPEN"

From QB64 Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
OPEN is used to open a file, COM(serial) or LPT(parallel) port.
 
OPEN is used to open a file, COM(serial) or LPT(parallel) port.
  
''Syntax 1:'' OPEN FileName$ FOR Mode AS #FileNumber
+
 
 +
''Syntax 1:'' OPEN FileName$ FOR Mode AS #FileNumber [LEN = Bytes]
  
  
Line 7: Line 8:
  
  
''Modes:'' Open can use 5 different modes:  
+
''Modes:'' Open can use 5 different access modes:  
  
 
   [[OUTPUT]]: Creates a new file or erases an existing file for program output
 
   [[OUTPUT]]: Creates a new file or erases an existing file for program output
   [[APPEND]]: Creates a new file or appends data output to an existing file
+
   [[APPEND]]: Creates a new file or appends data output to existing file
   [[BINARY]]: Creates a new file or uses input and/or output from an existing file
+
   [[BINARY]]: Creates a new file or uses input and/or output from existing file
   [[RANDOM]]: Creates a new file or uses input and/or output from an existing file
+
   [[RANDOM]]: Creates a new file or uses input and/or output from existing file
 
   [[INPUT]] : Only reads input from an existing file
 
   [[INPUT]] : Only reads input from an existing file
  
 
''FileNumber:'' as a low Integer number or a value from the [[FREEFILE]] function.
 
''FileNumber:'' as a low Integer number or a value from the [[FREEFILE]] function.
 +
 +
''Bytes:'' number of bytes used in a RANDOM record as defined by [[FIELD]] or [[TYPE]] definitions.

Revision as of 07:55, 28 August 2009

OPEN is used to open a file, COM(serial) or LPT(parallel) port.


Syntax 1: OPEN FileName$ FOR Mode AS #FileNumber [LEN = Bytes]


FileName$: as a string file name using the DOS 8.3 naming convention limits.


Modes: Open can use 5 different access modes:

 OUTPUT: Creates a new file or erases an existing file for program output
 APPEND: Creates a new file or appends data output to existing file
 BINARY: Creates a new file or uses input and/or output from existing file
 RANDOM: Creates a new file or uses input and/or output from existing file
 INPUT : Only reads input from an existing file

FileNumber: as a low Integer number or a value from the FREEFILE function.

Bytes: number of bytes used in a RANDOM record as defined by FIELD or TYPE definitions.