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-FileFdup()Fforce() GEMDOSSyntaxLONG Fforce( shandle, nhandle )
WORD shandle, nhandle;
Function Fforce() is used to redirect the standard input or output
from a GEMDOS standard handle to a specific handle created
by the application.
Opcode 70 (0x46)
Availability All GEMDOSversions.
Parameters shandle is a standard GEMDOS handle to be redirected.
nhandle is the new handle you wish to direct it to. Valid
values for shandle and nhandle are as follows:
Name Handle GEMDOS Meaning
filename
GSH_CONIN 0 con: Standard input (defaults to
whichever BIOS device is mapped to
GEMDOS handle -1)
GSH_CONOUT 1 con: Standard output (defaults to
whichever BIOS device is mapped to
GEMDOS handle -1)
GSH_AUX 2 aux: Currently mapped serial device
(defaults to whichever BIOS device
is mapped to GEMDOS handle -2)
GSH_PRN 3 prn: Printer port (defaults to
whichever BIOS device is currently
mapped to GEMDOS handle -3).
- 4 None Reserved
- 5 None Reserved
GSH_BIOSCON -1 None Refers to BIOS handle 2. This
handle may only be redirected
under the presence of MiNT. Doing
so redirects output of the BIOS.
GSH_BIOSAUX -2 None Refers to BIOS handle 1. This
handle may only be redirected
under the presence of MiNT. Doing
so redirects output of the BIOS.
GSH_BIOSPRN -3 None Refers to BIOS handle 0. This
handle may only be redirected
under the presence of MiNT. Doing
so redirects output of the BIOS.
GSH_MIDIIN -4 None GEMDOS handles -4 and 5 refer to
GSH_MIDIOUT -5 MIDI input and output
respectively. Redirecting these
handles will affect BIOS handle 3.
These special handles exist only
with the presence of MiNT.
Binding move.w nhandle,-(sp)
move.w shandle,-(sp)
move.w #$46,-(sp)
trap #1
addq.l #6,sp
Return Value Fforce() returns E_OK (0) if no error occurred or
EIHNDL (-37) if a bad handle is given.
Caveats Prior to GEMDOSversions 0.15, handles forced to the printer
would not work properly.
Comments This function is often used to redirect the input or output
of a child process. It should be used in conjunction with
Fdup() to restore the standard handle before process
termination. In addition, you should be aware that any file
handle redirected to a standard handle ('con:' for example)
will be closed when the child exits and should not be closed
by the parent. Standard GEMDOS file handles which have been
redirected will revert to their original mapping upon
Fclose().
See Also Fdup()