•  Back 
  •  GEMDOS Function Reference 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-FileFclose()
Fcreate()
Fopen()                                                              GEMDOS

Syntax

LONG Fopen( fname, mode )
char *fname;
WORD mode;

Function      Fopen() opens the GEMDOS file specified.

Opcode        61 ($3D)

Availability  All GEMDOS versions. mode bits pertaining to file

              sharing/record locking are only valid when the '_FLK' cookie
              is present.

Parameters    fname is the GEMDOS file specification of the file to be
              opened. mode specifies the mode the file is to be placed into
              once opened. mode is a bit array which may be formed by using
              the bit masks given as follows:

                 Bit 7       Bits 6-4   Bit 3      Bits 2-0

              Inheritance    Sharing    Reserved   Access code
                 flag         mode

              Bits 0-2 specify the file access code as follows:

              Bit 2     Bit 1    Bit 0    File Access Codes

                0         0        0      Read only access  (S_READ)

                0         0        1      Write only access (S_WRITE)

                0         1        0      Read/Write access (S_READWRITE)

              Bit 3 is reserved and should always be 0. Bits 4-6 specify
              the file sharing mode of the file to be opened as follows:

               Bit 6     Bit 5   Bit 4    File Sharing Codes

                 0         0       0      Compatibility Mode (S_COMPAT).
                                          If the file's read-only bit is
                                          set, then this is the same as
                                          Deny Writes, otherwise it is the
                                          same as Deny Read/Writes.

                 0         0       1      Deny Read/Writes
                                                      (S_DENYREADWRITE)

                 0         1       0      Deny Writes (S_DENYWRITE)

                 0         1       1      Deny Reads  (S_DENYREAD)

                 1         0       0      Deny None   (S_DENYNONE)

              Bit 7 (S_INHERIT) is the file's inheritance flag. If this
              flag is not set, a child process will inherit any open file
              handles and has the same access as the parent. If this flag
              is set, a child must re-open any files it wishes to use and
              must face the same sharing restrictions other processes must
              share.

Binding       move.w   mode,-(sp)
              pea      fname
              move.w   #$3D,-(sp)
              trap     #1
              addq.l   #8,sp

Return Value  Upon return, if the longword is positive, the lower WORD
              contains the new handle of the open file, otherwise the
              negative LONG should be regarded as a GEMDOS error code.


Comments      Bits 7-3 of mode should be set to 0 unless the '_FLK' cookie
              is present indicating the presence of the file sharing/record
              locking extensions to GEMDOS.

See Also      Fclose(), Fcreate()