This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Thanks Paul. > int read(int fd ,char * buf,int nbytes) > { > int i = 0; > > for (i = 0; i < nbytes; i++) { > *(buf + i) = inbyte(); > if ((*(buf + i) == '\r') || (*(buf + i) == '\n')) { > *(buf +i)='\n'; I understand this: convert your \r to a \n which, I assume, is what scanf() is looking for to terminate input? > outbyte('\r'); > outbyte('\n'); What is this for? I this custom for your system? I don't want to send stuff back to the host. > return i+1; > } > else > outbyte(*(buf+i)); ditto here? > } > return (i); > } > When it reads a \n or \r it breaks out of the loop. > i never gots incrmented. > So the number of chars read is reported as one too few. > The good old off by one bug ;-) Thanks again, -tim