Error "Unexpected '\n' when converting from type LockingTextReader to type int"

Synopsis a at a.com
Wed Sep 7 23:24:53 UTC 2022


On Wednesday, 7 September 2022 at 23:06:44 UTC, rikki cattermole 
wrote:
> Text in buffer: "123\n"
>
> Read: "123"
> Text in buffer: "\n"
>
> Read: exception, expecting number for "\n"
>
> Changing your readf format specifier to include the new line 
> should work.
>
> https://dlang.org/phobos/std_stdio.html#.File.readf


Thank you!
Adding the \n seems to solve my problem: ```readf("%s\n", 
&f1.num)```

I have two further questions about this!

a- What is the difference with this syntax with the exclamation 
mark? ```readf!"%s\n"(f1.num);```

b- Do I need to put ```/n``` in every readf statement? I mean, 
considering that every input gets entered after pressing intro 
key (and I guess this is what introduce the \n)


Forgive me if I'm asking silly questions.


More information about the Digitalmars-d-learn mailing list