Eyeon:Script/Reference/Libraries/io/output
From VFXPedia
IO: io.output
Contents |
Arguments
io.output( [file] )
- file (optional, file handle or file name)
A file handle object or the path to a file on disk.
Returns
This function does not return a value.
Remarks
The io.output() function sets the default output file. The default output is the file used by the io class of functions, for example a call to io.write() will write data to the default output file.
If this function is called with a string specifying a path to a file on disk it opens the file names, and sets its file handle to the default output. If this function is called with a file handle object as its argument the file handle is set as the default output.
If this function is called without any arguments it returns the file handle object for the current output.
This function does not return an error code, if it fails it simply raises an error, which is likely to halt the script. This behavior means that it is usually wiser to use io.open to set a file handle, and then assign that handle to io.output.
Requirements
- eyeonScript 5.0
- Fusion 5.0
Examples
--command line script -- any text types at the prompt will -- automatically be written to the -- file c:\out.txt, until a line that says -- end is typed
io.input( io.stdin ) fh, errormsg = io.open("C:/out.txt", "w")
if not fh then
print(errormsg) os.exit(10)
end
io.output(fh) x = io.read("*l")
while not (x == "end") do
io.write(x, "\n") io.flush() x = io.read("*l")end