Thread overview | |||||
---|---|---|---|---|---|
|
April 18, 2015 Bug in DDT | ||||
---|---|---|---|---|
| ||||
Readln function is activated before the writeln("test"): ----- import std.stdio; void main() { writeln("test"); string s = readln; writeln(s); } ----- |
April 21, 2015 Re: Bug in DDT | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dennis Ritchie | On 18/04/2015 05:24, Dennis Ritchie wrote: > Readln function is activated before the writeln("test"): > > ----- > import std.stdio; > > void main() { > > writeln("test"); > > string s = readln; > > writeln(s); > } > ----- It's a problem related to flushing. The `writeln("test")` is not flushing its output before the readln happens. http://stackoverflow.com/questions/19498040/eclipse-console-writes-output-only-after-the-program-has-finished Bug report: https://issues.dlang.org/show_bug.cgi?id=13778 -- Bruno Medeiros https://twitter.com/brunodomedeiros |
April 22, 2015 Re: Bug in DDT | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | On Tuesday, 21 April 2015 at 12:33:29 UTC, Bruno Medeiros wrote:
> On 18/04/2015 05:24, Dennis Ritchie wrote:
>> Readln function is activated before the writeln("test"):
>>
>> -----
>> import std.stdio;
>>
>> void main() {
>>
>> writeln("test");
>>
>> string s = readln;
>>
>> writeln(s);
>> }
>> -----
>
> It's a problem related to flushing. The `writeln("test")` is not flushing its output before the readln happens.
>
> http://stackoverflow.com/questions/19498040/eclipse-console-writes-output-only-after-the-program-has-finished
>
> Bug report: https://issues.dlang.org/show_bug.cgi?id=13778
Thanks.
-----
import std.stdio;
void main() {
writeln("test");
stdout.flush;
string s = readln;
writeln(s);
}
-----
|
Copyright © 1999-2021 by the D Language Foundation