•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileOPEN mode$,#n,name$[,len]

mode$, name$: sexp
n, len: iexp

OPEN opens a data channel to a file or to a peripheral device. The expression
mode$ sets one of the following access modes:

mode$              Description
O  output          A file is opened to receive data. If neccessary the file
                   will be created, or, if the file already exists its contents
                   will be deleted.

I  input           A file is opened for reading.

A  append          An existing file is opened, and the data pointer set to the
                   end of the file. Data output to the file will then be added
                   at that point.

U  update          An existing file is opened for reading and writing.

R  random access   A Random Access file is opened for reading and writing.
                   This file type is described fully later.

The numerical expression n contains the channel number and can take a value
from 0 to 99. This channel number must be specified when working with the file.
The '#' sign before the channel number can be omitted, as the Editor will
supply it anyway. The expression name$ contains the access path and the file
name of the required file.

Instead of a file name, a peripheral device can be specified. The numerical
expression len is only used with the Random Access mode and defines the length
of a data record. The maximum record length is 32767 bytes, and the maximum
number of fields approximately 5000. If len is not specified a default value
of 128 is assumed.

The following device names can be used:

name$                                      Device              Internal use
LST: List                                  Printer (parallel)  BIOS 0
AUX: Auxiliary                             Serial (RS232)      BIOS 1
CON: Console                               Keyboard/Screen     BIOS 2 or VDI
MID: Musical Instrument Digital Interface  MIDI port           BIOS 3
IKB: Intelligent KeyBoarD controller       Keyboard processor  BIOS 4
VID: Video                                 Monitor             BIOS 5 or VDI
PRN: Printer                               Printer             GEMDOS -3
STD: Console (stdin/stdout)                Keyboard/Screen     GEMDOS 1

LPT: same as PRN:
COM: same as AUX:

Example:

    OPEN "O", #1,"TEST.TXT" !send data to a file

    or

    OPEN "O", #1,"PRN:" !send data to the printer

Memo: From BUGFIXED.TXT from my master disk:
      There is a new device called 'STD:'. This is the same as 'stdin' and
      'stdout' respectively in C-programs. A shell can be used to redirect the
      output of a GFA-BASIC program.

          GFABASIC TEST >DUMMY

      This line starts GFA-BASIC and the program TEST.GFA. Any output via
      'STD:' is redirected to the file DUMMY.

      IMPORTANT: Control-C will cause termination of the program if pressed
      while reading/writing file DUMMY. The default for input/output is the
      keyboard/console.

      Only the first character of the mode$ parameter matters. The length is
      not checked at all.

      Device numbers =>6 are not supported by the OPEN command.
      To access such devices, use Operating System calls instead.

      Device PRN: does not work correctly on the Falcon030.
      Internally GFA uses GEMDOS handle -3, which should of been handle 3.

      If len is specified for non "R" files, it is ignored.

Fopen()+, Fcreate()+, The IKBD Controller+, IKBD command codes+