[Gambas-user] commandline output redirect?

Ron ron at ...1740...
Wed May 21 14:09:31 CEST 2008


Benoit Minisini schreef:
> 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?
>   
Benoit ,

here: http://gambasdoc.org/help/lang/open

next to the ! mark

> 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.
>
>   
I'm flushing now inside my loop every now and then, that seems to work.

Is it possible to catch keyboard input while running command line app?
Sorry for the questions, but my app is using alot of different command 
and routines.

Thanks.
Ron.







More information about the User mailing list