On Sun, 3 Apr 2011, Kjetil S. Matheussen wrote:
{
int fd=fileno(stdout);
while(bytes_to_write > 0){
int written=write(fd,tobuffer,bytes_to_write);
if(written==-1){
fprintf(stderr,"Error writing to stdout.\n");
break;
}
bytes_to_write -= written;
}
}
Ouch, there's a bug there! 'tobuffer' must change position
in case written<bytes_to_write. :-(
(BTW. How likely is it that 'write' doesn't write all bytes?)