I have: glibc-2.1-990920.tar.gz from RedHat 6.1 glibc-990416.tar.gz from RedHat 6.0 Running RedHat 6.1 on a dual processor Intel pII with glibc-2.1-990920.tar.gz appears to have a problem of dropping the last character when read is called to a serial device. fd is an open file descriptor of a serial port set to block one character. Data is in the form of dec 70 some ascii string terminated by dec 13 or dec 10(depends on which version of library used) This data is comming from a barcode reader and unfortunately I'm not sure of the correct value of the terminator. In glibc-2.1-990920.tar.gz(2.1.2) : This works and includes the decimal 13 terminator : char c; while (1) { read(fd,&c,1); printf("c is %d\n",c); } Output is : c is 70 c is 57 c is 55 c is 56 c is 48 c is 50 c is 48 c is 49 c is 51 c is 48 c is 56 c is 50 c is 49 c is 49 c is 13 This drops the last character which is a decimal 13: char buff[255]; while(1) { read(fd, buff,1); printf("buff is %d \n", buff[0]); } buff is 70 buff is 57 buff is 55 buff is 56 buff is 48 buff is 50 buff is 48 buff is 49 buff is 51 buff is 48 buff is 56 buff is 50 buff is 49 buff is 49 -<<<<what happend to the terminator???? In glibc-990416.tar.gz(2.1.1) both cases work but the string is terminated by DEC 10. I tried a clean version of glibc-2.1.2 from sourceware.cygnus.com and have the same problem with the terminator being dropped if the data is stored in a char array. BUT the character is not dropped if the data is stored in a character.
What is displayed if you check the read system call for errors? if (read(fd,&c,1) < 0) perror("read");
Waiting on feedback.