simulate getch()

B

berlin860

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.
 
F

F. Meyer

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

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

F. Meyer

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

B&R

F. Meyer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top