ali@polya.STANFORD.EDU (Ali Ozer) (03/01/88)
Am I the last one to find out? In that case why didn't anyone tell me? Although K&R say that getchar() can be defined as ``getc(stdin),'' this apparently is *not* the case with Manx C (3.4 and probably all versions). This bit me, and it took me a good FIVE minutes to debug. Five minutes isn't much, unless you consider that it took 30 seconds to type in the program and 15 seconds to compile & link. (A byte-swapping program; how complicated can it get?) After I dug up the manual, I read that getchar() is defined as ``agetc(stdin),'' not ``getc(stdin).'' ``Agetc'' does some nice conversions for you, and throws out the null bytes. So a file-copier (or byte-swapper) written with getchar() won't work correctly, while one written with getc(stdin) will do the job. And do I remember, at the last BADGE meeting, someone saying that you don't need the manual to use Manx C? Before you flame me --- Yes, I realize C libraries can be defined any way implementors please. Just wanted to let future Manx getchar() users know. In any case, I still love my Manx C. Probably even more when SDB finally arrives. Ali Ozer, ali@polya.stanford.edu