Getch() Problem: C vs D
LouisHK via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 8 13:19:15 PST 2017
Hello, I minimize the problem to identify the problem:
Here the C version:
#include <stdio.h>
int main(){
int c;
while(c != 27){
printf("%d\n", (c = getch()));
}
return 0;
}
And works fine, but the D version below nothing happens when I
hit ESCAPE:
import std.stdio;
extern (C) int getch();
int main(){
int c;
while(c != 27){
printf("%d\n", (c = getch()));
}
return 0;
}
Is this a bug or there is another approach?
Thanks,
L.
More information about the Digitalmars-d-learn
mailing list