CompuServe Messages

C problems

    06-Mar-91 18:20:02
Sb: #8142-C problems
Fm: Robert Hayes 70431,1737
To: Greg Comeau@Comeau Cmptg 72331,3421
True enough, but beauty is only skin deep. If _everybody_ would learn how to program in _assembly_, we wouldn't have these type of problems. However, after looking the program over, I feel humbled by the root of the problem. I use Manx, and you must link with the -lc32 library as: ln program.o -lc32 Also, delete the c = 0, it is not needed. But of course, you will find that now you have two "responses" every time you "enter" a keystroke. The getchar() is not really suited to reading from the keyboard. What now happens is that the correct choice he made is printed to screen first, then the default choice is printed because getchar() also accepts and sends his program the "enter" key (that is '\r', I believe). The programmer , would be better off defining a char string of 2 char long, and just compare the first char in the string with the case statement. I felt humbled because it took me 1.5 hours of "ferocious" programming to remember about the -lc32 thing and the printf for Manx. Robert (when it rains, I get wet)