From: "Florent" Newsgroups: comp.os.msdos.djgpp Subject: read a character string from a serial port ...... Date: Tue, 15 Aug 2000 23:38:44 +0200 Organization: Aachen University of Technology (RWTH) Lines: 45 Message-ID: <8ncd7g$18p$1@nets3.rz.RWTH-Aachen.DE> NNTP-Posting-Host: pupulse.oih.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 966375472 1305 137.226.149.42 (15 Aug 2000 21:37:52 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 15 Aug 2000 21:37:52 GMT X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, I manage to read a character from the serial port but I'm having problemes for reading character string. Here is my function which read the character string : int ReceiveString (int ComNo,char *received,int *base) { int b,i=0,j=0; char string[127]; string[0]=NULL; b = base[ComNo-1]; if (!b) return 0; if ((inportb(b+STATUS) & 1) == 0) return 0; while (inportb(b+STATUS) & 1) { inportb(b+STATUS); string[i] = inportb (b); i++; string[i]=NULL; delay(1); }; strcpy(received,string); return 1; } ComNo is the port com choosen, and base are the adress of the serial port. The things is that I can just read character by character, and sometimes I miss some character. I call my function in a loop, in order to get character (or character string) at any moment. I tried to put a small delay, but doesn't work well , I miss gain some characters. Does the serial port has a buffer ? Can we change the size of this buffer ? Do you have any clue for my function ? Thanks for helping me, best regards, Florent.