Error "Unexpected '\n' when converting from type LockingTextReader to type int"
Ali Çehreli
acehreli at yahoo.com
Thu Sep 8 02:37:24 UTC 2022
On 9/7/22 16:24, Synopsis wrote:
> a- What is the difference with this syntax with the exclamation mark?
> ```readf!"%s\n"(f1.num);```
That's the templated version, which is safer because it checks at
compile time (important distinction) that the arguments and the format
specifiers do match.
> b- Do I need to put ```/n``` in every readf statement?
Another option is to use a space character, which reads and skips any
number of any whitespace character. I have written something about that
here:
http://ddili.org/ders/d.en/input.html
And this one talks about readln, which may be more suitable in some cases:
http://ddili.org/ders/d.en/strings.html
And there is formattedRead:
http://ddili.org/ders/d.en/strings.html#ix_strings.formattedRead
> Forgive me if I'm asking silly questions.
There is never a silly question. If a question came up, it is as
legitimate as it gets.
And welcome to programming! :)
Ali
More information about the Digitalmars-d-learn
mailing list