-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 13 Jan 2004 20:33:38 +0000 Ged <ged.suse@ntlworld.com> wrote:
It seems to stick on 11. It won't always let me input item number 12. The items i'm trying to enter are as follows.
I definitely won't have a chance to do anything until possibly tomorrow afternoon. But, just to mirror Trey's sentiment, getch()/conio.h is a Windows function call, not Unix/Linux. cls is a Windows command line command. The Unix/Linux equivalent is clear. This is supposed to be a SuSE Linux programming list. On Linux you can easily write the equivalent of the getch() function. This function is written for C, not C++. You will need to change the includes to #include <cstdio>, #include <cerrno>. Note that the file descriptor for input is normally 0, but there is a C++ function in the iostream library that is equivalent to the filenum() function in C, but I don't recall it at the moment. #include <stdio.h> #include <errno.h> #include <unistd.h> /* for read() */ #include <termios.h> char GetOne(int fd) { int rv; char ch; struct termios oldflags, newflags; /*********** Reset the terminal to accept unbuffered input ***/ /* get the current oldflags */ tcgetattr(fd, &oldflags); /* make a copy of the flags so we can easily restore them */ newflags = oldflags; /* set raw input */ newflags.c_cflag |= (CLOCAL | CREAD); newflags.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); /* set the newflags */ tcsetattr(fd, TCSANOW, &newflags); rv = read(fd, &ch, 1); /* restore the oldflags -- This is important otherwise * your terminal will no longer echo characters */ tcflush(fd, TCIFLUSH); tcsetattr(fd, TCSANOW, &oldflags); return ch; } - -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iD8DBQFABFvf+wA+1cUGHqkRAif7AJ44RMJwOm5CpLa2CUqe0gAk6skIeACghAqX 500oykvtbVIVd2aiemj0uBg= =hgv1 -----END PGP SIGNATURE-----