Hi all, this may be a really newbie question but I'm not really used to
medium/low level stuff like this. I've actually done the same in Python,
and it just works...
Supose I want my program to print some content on a given line, lets say
"First name: value1", then it should sit down and wait for me to press
Enter, then print "Second name: value2", then sit down again, and so on.
I've tried to do that the following way:
import std.stdio;
void myFunc(string name, double value) {
write(name, value);
string buf;
readf(" %s", buf);
}
then I just call multiple times:
void main() {
myFunc("First name: ", value1);
myFunc("Second name: ", value2);
(...)
}
It works almost perfectly, except that it doesn't wait for my first
Enter after printing "First name: value1". Rather, it prints both "First
name: value1" and "First name: value2" together on the same line, then
it starts to behave as expected, e.g. printing one line at a time and
waiting for me to press Enter.
I experimented substituting readf for readln, but then it doesn't
recognize my Enter presses and hangs on.
What is a more suitable aproach to this problem please?
Thanks,
Cleverson