Date: Sat, 27 Apr 1996 22:28:13 -0400 (EDT) From: "Y. Lazarovitch" To: djgpp AT delorie DOT com Subject: more cgets() problems... Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII I had a program that sits in a loop and gets and prints input using the cgets/cprintf functions. When I would hit an arrow key, it would seem as if cgets stops taking input, and after a few seconds I would get a "general protection" error and the program would crash. This small program, although it doesn't cause a GPF (it was probably some other part of my program that caused it) does show that cgets(), once it gets an arrow key, continues "getting" some kind of input, and stops when it reaches the maximum characters specified, and when cgets() is called again, it still gets the same garbage, and so on. ==begin== #include #include int main() { char input[10]; input[2] = 'a'; /* to fool while first time around */ input[0] = 5; /* cgets() uses this to know max chars to read */ cprintf("Enter a max of 4 characters, 0 to stop.\r\n"); cprintf("\r\n(Push the up arrow to see bug (?))\r\n"); while(input[2] != '0') { /* first char input is in third element */ cgets(input); cprintf("\r\nYou entered: %s\r\n", input + 2); } return 0; } ==end== Run this and you'll see the problem. Good day, YL