digitalmars.D - readln and readf issues
- Jacob Marek (13/13) Nov 11 2016 Hi! so I'm probably being dumb here however I'm having an issue
- Robert burner Schadek (9/22) Nov 11 2016 What platform? I'm not 100%, but on *nix writeln goes to stdout
- Daniel Kozak via Digitalmars-d (2/14) Nov 11 2016 http://stackoverflow.com/questions/39165247/order-of-method-invocation-m...
- Jacob Marek (3/20) Nov 11 2016 Thank you very much. That link had everything I needed to
Hi! so I'm probably being dumb here however I'm having an issue
getting readf and readln to work properly. It seems to be
superseding the rest of my code. Allow me to explain. No matter
where I put the readf/readln function it will get hung up in the
console waiting for input. An example is below where this occurs
(only after inputting an int and pressing enter does hello print)
I am using eclipse with the standard DMD compiler. Any help is
appreciated!
void main() {
writeln("hello");
int q;
readf(" %s", &q);
}
Nov 11 2016
On Friday, 11 November 2016 at 09:43:51 UTC, Jacob Marek wrote:
Hi! so I'm probably being dumb here however I'm having an issue
getting readf and readln to work properly. It seems to be
superseding the rest of my code. Allow me to explain. No matter
where I put the readf/readln function it will get hung up in
the console waiting for input. An example is below where this
occurs (only after inputting an int and pressing enter does
hello print) I am using eclipse with the standard DMD compiler.
Any help is appreciated!
void main() {
writeln("hello");
int q;
readf(" %s", &q);
}
What platform? I'm not 100%, but on *nix writeln goes to stdout
of the process and read* reads from stdin of the same process.
The problem is that stdout is not connected stdin of the same
process. In other words readf never gets past the "hello". Create
two programs and connect them as such "writeProgram |
readProgram".
p.s. next time, please post such to the learn subforum, thats
properly a better place for this.
Nov 11 2016
Dne 11.11.2016 v 10:43 Jacob Marek via Digitalmars-d napsal(a):
Hi! so I'm probably being dumb here however I'm having an issue
getting readf and readln to work properly. It seems to be superseding
the rest of my code. Allow me to explain. No matter where I put the
readf/readln function it will get hung up in the console waiting for
input. An example is below where this occurs (only after inputting an
int and pressing enter does hello print) I am using eclipse with the
standard DMD compiler. Any help is appreciated!
void main() {
writeln("hello");
int q;
readf(" %s", &q);
}
http://stackoverflow.com/questions/39165247/order-of-method-invocation-mixed-up
Nov 11 2016
On Friday, 11 November 2016 at 10:05:14 UTC, Daniel Kozak wrote:Dne 11.11.2016 v 10:43 Jacob Marek via Digitalmars-d napsal(a):Thank you very much. That link had everything I needed to understand and fix the issue!Hi! so I'm probably being dumb here however I'm having an issue getting readf and readln to work properly. It seems to be superseding the rest of my code. Allow me to explain. No matter where I put the readf/readln function it will get hung up in the console waiting for input. An example is below where this occurs (only after inputting an int and pressing enter does hello print) I am using eclipse with the standard DMD compiler. Any help is appreciated! void main() { writeln("hello"); int q; readf(" %s", &q); }http://stackoverflow.com/questions/39165247/order-of-method-invocation-mixed-up
Nov 11 2016









Robert burner Schadek <rburners gmail.com> 