Tango I/O bug?
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Mon Sep 17 15:53:30 PDT 2007
Jason House wrote:
> Sean Kelly Wrote:
>
>> Jason House wrote:
>>> outStream.formatln("= {}\n", valueToReturn); // adds extra \n and flushes
>> Seems okay, though it's difficult to say from just that line. Is output
>> redirected? Are objects being re-used? Is .close() perhaps not being
>> called if output is to a file?
>
>
> Output is going to Cout.stream and is never closed. The code relies on formatln to flush the output. It does real time communication in plain text with a 3rd party controlling application. This line really was from the program. In this particular example, valueToReturn is of type char[] and is literally "HouseBot"
This part is likely your problem: "It does real time communication in
plain text with a 3rd party controlling application"
That probably means the output is redirected and not sent to an actual
console, right?
The default behavior for Stdout is to auto-flush only if the output is
sent to an actual console (i.e. isn't redirected).
To make sure flushing occurs, execute "Stdout.flush = true;" somewhere
at the start of your program (main(), a static this(), or just right
before the first output).
More information about the Digitalmars-d-learn
mailing list