A possible readf int bug
Matilda
marusiavrn at gmail.com
Sun Jun 27 19:50:09 UTC 2021
I'm trying to read from stdin and then print an integer value.
This is how my code looks like:
```d
import std.stdio;
import std.conv;
import std.string;
void main()
{
writeln("Input your variant (1 - 10):");
int key;
//readf(" %d", &key);
//readf!" %d"(key);
key = readln.strip.to!int;
writefln("Your variant is: %d", key);
}
```
The problem is that the programme doesn't work if I try to use
one of the commented readf functions. It doesn't print the last
phrase. There is no error message. It just waits for nothing
apparently. It works with the stip.to!int line, so the problem
must be with readf.
I'm kind of new to this language and I don't have much experience
with programming in general, so I have no way to know if it's
just me being dumb or I've accidently found a bug.
I use DMD32 D Compiler v2.097.0-dirty
More information about the Digitalmars-d-learn
mailing list