outputFile¶
Sets the output file or the error message output file.
Synopsis¶
outputFile ( )
Optional Arguments¶
setOutputFile
, FILE (Input)Set the output file to
setOutputFile
.Default:
setOutputFile
=stdout
getOutputFile
, FILE (Output)- Set the FILE pointed to by
getOutputFile
to the current output file. setErrorFile
, FILE (Input)Set the error message output file to
setErrorFile
.Default:
setErrorFile
=stderr
getErrorFile
, FILE (Output)- Set the FILE pointed to by
getErrorFile
to the error message output file.
Description¶
This function allows the file used for printing by PyIMSL functions to be changed.
If multiple threads are used then default settings are valid for each
thread. When using threads it is possible to set different output files for
each thread by calling outputFile
from within each thread.
Example¶
This example opens the file myfile
and changes the output file to this
new file. The function writeMatrix
then writes to this file.
from pyimsl.math.fopen import fopen
from pyimsl.math.fclose import fclose
from pyimsl.math.outputFile import outputFile
from pyimsl.math.writeMatrix import writeMatrix
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