how stdin stream works?
Flade
consolemaster0 at gmail.com
Wed Aug 19 17:44:24 UTC 2020
Hi everyone! I'm trying to do error handling (with the try block)
and when I give a wrong value to the variable (it is an integer
and I give a non-number value), then It doesn't let me re get
input. The code:
int x;
bool not_accepted = false;
while (!not_accepted) {
try {
write("x: ");
readf("%d\n", x);
not_accepted = true;
} catch (Exception msg) {
writeln("Please give a right coordinate");
}
More information about the Digitalmars-d-learn
mailing list