tlhilde@ecn.purdue.edu (Troy Hildebrand) (05/30/90)
Well, after looking through the frequently asked questions list with no luck, I hope somebody out there will be able to help me. I am trying to read serial data from COM1 on a Powerflex 386. I am opening the port as a file using fp=fopen("COM1","r"); and have tried several different ways of reading from the file, ranging from getc(fp) while not eof, scanf("%s\n",line), where line is a character pointer, etc... These methods have all worked to some degree. The problem is, I inevitably get a dos error.. "General error reading COM1" or something very similar. The test for end of file works fine. When the sending device is done sending data, it sends an eof, and the program will exit normally. The error can come anytime after starting to read from the file, but generally after 10 or more lines. But not always. oh, and the ports is set (through dos 'mode' command) to be the same protocol as the serial device is set to send. Anyway, the question is this: are there any special tricks to reading serial data from COM1 without getting spurious DOS errors? Thanks, Troy Hildebrand -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy Hildebrand | That'll be the last | The Internet: more than just tlhilde@en.ecn.purdue.edu | teacup I have... | a free phone system! Whee! tiptop@vet.vet.purdue.edu |