Why does calling readln() more than once not work

Ruby The Roobster michaeleverestc79 at gmail.com
Thu Jan 28 19:35:31 UTC 2021


On Thursday, 28 January 2021 at 19:31:35 UTC, Adam D. Ruppe wrote:
> On Thursday, 28 January 2021 at 19:25:52 UTC, Ruby The Roobster 
> wrote:
>>         readf(" %d",&tempy);
>
> This leaves the \n at the end. A next readf thanks to the 
> leading space would ignore that \n and keep going, but a readln 
> stops at the first \n it sees, even if it is a leftover item in 
> the buffer from a readf before.

I replaced readln with the following: readf(" %s\n",&tempz);
That seemed to do the trick(and note here, when you press enter, 
it stops taking input).


More information about the Digitalmars-d-learn mailing list