in reply to
Re: How to concatenate N binary buffers?
in thread How to concatenate N binary buffers?
syswrite $out, $buf1, $bufsize;
syswrite $out, $buf2, $bufsize;
If a constant number $bufsize of bytes is always written, then when fewer than $bufsize bytes are read, typically at the end of a file, a block of junk will be written to the output file between the $buf1 and $buf2 blocks (Update: and also from the end of $buf2 to the end of the output file).
Better to follow choroba's advice and record the bytes actually read, then write just that number of bytes (but still without the need for explicit concatenation):
syswrite $out, $buf1, $size1;
syswrite $out, $buf2, $size2;