XL Fortran for AIX 8.1

User's Guide


I/O Redirection

You can use the redirection operator on the AIX Operating System command line to redirect input to and output from your XL Fortran program. How you specify and use this operator depends on which AIX shell you are running. Here is a ksh example:


$ cat redirect.f
        write (6,*) 'This goes to standard output'
        write (0,*) 'This goes to standard error'
        read (5,*) i
        print *,i
        end
$ xlf95 redirect.f
** _main    === End of Compilation 1 ===
1501-510  Compilation successful for file redirect.f.
$ # No redirection. Input comes from the terminal. Output goes to
$ # the screen.
$ a.out
 This goes to standard output
 This goes to standard error
4
           4
$ # Create an input file.
$ echo >stdin 2
$ # Redirect each standard I/O stream.
$ a.out >stdout 2>stderr <stdin
$ cat stdout
 This goes to standard output
           2
$ cat stderr
 This goes to standard error

You can refer to the following sections of the AIX Commands Reference for more information on redirection:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]