undefined identifier getch()
Steven Schveighoffer
schveiguy at yahoo.com
Wed Dec 8 05:57:40 PST 2010
On Wed, 08 Dec 2010 08:25:38 -0500, Nrgyzer <nrgyzer at gmail.com> wrote:
> Okay, but what function can I use to get the pressed key?
> kbhit/_kbhit seems to do what I want, but hwo can I use it in D? I
> always get the error, that kbhit (or similar functions) are not
> available.
>
> import std.stdio;
> import std.c.stdlib;
> import std.c.windows.windows;
extern(C) int kbhit(void);
> void main(string[] args) {
> kbhit();
> }
In order to call a C function you have to declare it. That's all
std.c.windows.windows does. Just not all the functions are declared.
Plus, I saw that getch is in that header as well...
http://www.digitalmars.com/rtl/conio.html#_getch
-Steve
More information about the Digitalmars-d-learn
mailing list