1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
/*
Falcon Samples.
Standard I/O streams test.
This just checks for standard VM streams to work correctly
by reversing the input stream to the output stream (line
by line) and then writing the number of parsed line to
the standard error.
*/
> '
Test for ''standard input stream''
Enter some text line; it will be printed in reverse order to
confirm it has been read.
After entering some line, close the stream with CTRL+D on UNIX
and CTRL+Z (then enter) on MS-Windows. The count of read lines
will be printed.'
sInput = stdIn()
sOutput = stdOut()
sError = stdErr()
count = 0
line = ""
while not sInput.eof()
if sInput.readLine( line, 512 ) == 0: continue
if line.len() == 1
sOutput.write( line )
else
sOutput.write( line[-1:0] )
end
sOutput.write( "\n" )
count++
end
sError.write( @"\nParsed $count lines\n\n" )
/* End of stdStreams.fal */
|