•  Back 
  •  File functions 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help page 
  •  Show info about hypertext 
  •  View a new file 
Topic       : TOS - The Operating System
Author      : 
Version     : tos.hyp (December 19, 2008)
Subject     : Programmieren/Atari
Nodes       : 3010
Index Size  : 93790
HCP-Version : 5
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Title
@help       : 
@options    : +g -i -s +x +zz -t4
@width      : 70
View Ref-File5.10.12  Fforce                                                    TOS

 Name:         »File force« - Redirect standard file.

 Opcode:       70

 Syntax:       int16_t Fforce ( int16_t stdh, int16_t nonstdh );

 Description:  The GEMDOS routine Fforce redirects a standard channel 
               to a specific other channel created by the application. 
               The following apply:

                stdh     Channel to be redirected
                          0 =     Keyboard (stdin, con:)
                          1 =     Screen (stdout, con:)
                          2 =     Serial port (stdaux:)
                          3 =     Parallel port (stdprn:)
                nonstdh  Number of the replacement channel (as above)

               Under MiNT further channels may be redirected:

                -1 =     Refers to BIOS handle 2, redirects BIOS 
                         output
                -2 =     Refers to BIOS handle 1, redirects BIOS 
                         output
                -3 =     Refers to BIOS handle 0, redirects BIOS 
                         output
                -4 =     GEMDOS handles -4 and -5 refer
                -5 =     to MIDI input and output respectively. 
                         Redirecting them will affect BIOS handle 3.

               Note: As of MagiC 4, this function can be used to 
               redirect device files -1,-2 and -3 (system global). The 
               NULL device (-4) however may not be redirected.

               To redirect, say, screen output to a printer one can 
               use a construct such as Fforce(1, Fdup(3)).

 Return value: The function returns the following results:

                E_OK :    No error has arisen
                EIHNDL :  Incorrect handle

 Availability: All GEMDOS versions.

 Group:        File functions

 Comment:      This function is used often to redirect the input or 
               output of a child process. It should be used together 
               with Fdup to restore the standard handle before the 
               process terminates. You should note also that any file 
               handle redirected to a standard handle (say con:) will 
               be closed when the child exits and should not be closed 
               by the parent.

 See also:     Binding   Fdup   Directory U:DEV