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?)
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Sun Apr 3 16:15:01 2011
This archive was generated by hypermail 2.1.8 : Sun Apr 03 2011 - 16:15:01 EEST