468,248 Members | 1,479 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,248 developers. It's quick & easy.

simulate getch()

hello everyone:
I want to programming c++ with asm to simulate the getch().
getch() is included in <conio.h>, it's function is to get a
character from keyboard, but not echo.
my code as follow:
char my_getch()
{
char chr;
_asm
{
mov ah, 07H
INT 21H
mov chr, al
}
return chr;
}

but cannot pass the compiler. my complier is CL 7.1.

Mar 5 '06 #1
2 2992

To pause use system("PAUSE"); and #include <stdlib.h> or cstdlib

Also try getchar(); instead of getch() and #include <stdio.h>

Mar 5 '06 #2
To pause use system("PAUSE"); and #include <stdlib.h>
Also try getchar(); instead of getch() and #include <stdio.h>

B&R

F. Meyer

Mar 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by voidstar | last post: by
2 posts views Thread by Shugong Wang | last post: by
4 posts views Thread by aurgathor | last post: by
4 posts views Thread by Crow | last post: by
1 post views Thread by Ratheesh Kumar | last post: by
45 posts views Thread by simnav | last post: by
5 posts views Thread by Sankar | last post: by
8 posts views Thread by Michele 'xjp' | last post: by
16 posts views Thread by fuzhen | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.