outputFile

Sets the output file or the error message output file.

Synopsis

outputFile ()

Optional Arguments

setOutputFile, FILE (Input)

Sets the output file to setOutputFile.

Default: setOutputFile = stdout

getOutputFile, FILE (Output)
Sets the FILE pointed to by getOutputFile to the current output file.
setErrorFile, FILE (Input)

Sets the error message output file to setErrorFile.

Default: setErrorFile = stderr

getErrorFile, FILE (Output)
Sets the FILE pointed to by getErrorFile to the error message output file.

Description

This function allows the file used for printing by PyMSL functions to be changed.

Example

This example opens the file myfile and sets the output file to this new file. Function writeMatrix then writes to this file.

from pyimsl.stat.fopen import fopen
from pyimsl.stat.fclose import fclose
from pyimsl.stat.errorOptions import errorOptions
from pyimsl.stat.free import free
from pyimsl.stat.writeMatrix import writeMatrix
from pyimsl.stat.outputFile import outputFile
from pyimsl.stat.tableOneway import tableOneway
from pyimsl.stat.randomSeedSet import randomSeedSet
from pyimsl.stat.randomUniform import randomUniform
from threading import Thread
x = [3.0, 2.0, 1.0]
writeMatrix("x (default file)", x)
ofile = fopen("myfile", "w")
outputFile(setOutputFile=ofile)
writeMatrix("x (myfile)", x)
fclose(ofile)

Output

 
          x (default file)
          1            2            3
          3            2            1

File myfile

x (myfile)
1           2           3
3           2           1