[Gambas-user] commandline output redirect?
Benoit Minisini
gambas at ...1...
Wed May 21 13:26:26 CEST 2008
On mercredi 21 mai 2008, Ron wrote:
> Hi,
>
> If you create a gambas command line application with a loop in it,
> standard output cannot be redirected to a file.
>
> This works:
> -----------------------------------
> PUBLIC SUB Main()
> PRINT "test output"
> END
>
> ./test.gambas >test.log
> cat test.log
> test output
>
> This doesn't work:
> ------------------------------------
> PUBLIC SUB Main()
> PRINT "test output"
> WHILE (1)
> 'do something
> WAIT 1
> WEND
> END
>
> ./test.gambas >test.log
> CTRL-C
> test.log is empty
> ------------------------------------
> Unbuffered printing to default output (with Write "test output") gives
> the same result.
>
>
> Gambas 2.6.0
>
> Regards,
> Ron.
>
Where did you see that WRITE is unbuffered and PRINT is buffered?
Standard output and standard error output are both buffered, whatever stream
instruction or function you use.
If you want to flush a buffered output stream, just use the FLUSH instruction.
I suggest you read the documentation on Gambas File I/O functions.
Regards,
--
Benoit Minisini
More information about the User
mailing list