Originally Posted by
explosive
getch() doesnt work in the compilers i use.
?
My dev-c++ has conio.h and getch(). The following illustrates getch() and works on my Windows box when compiled with Borland C, Microsoft VC++, and as a file in a dev-c++ project:
Code:
#include <stdio.h>
#include <conio.h>
int main(int argc, char *argv[])
{
int c;
printf("Press ctrl-c to quit\n");
while ((c = getch()) != 3) {
putchar(c);
if (c == '\r') {
putchar('\n');
}
}
return 0;
}
(Of course if you don't want to echo the character, you could use, say putchar('*'), to put an asterisk in place of the user input.)
Regards,
Dave