/* Using getch() to input strings. */ /* Non-ANSI code */ #include #include #define MAX 80 main() { char ch, buffer[MAX+1]; int x = 0; while ((ch = getch()) != '\r' && x < MAX) buffer[x++] = ch; buffer[x] = '\0'; printf("%s", buffer); return 0; }