Output decoding lose bytes?

When i used the Pervasives output function (val output : out_channel -> bytes -> int -> int -> unit) to decode bytes, the resulted file has less bytes than the original length of bytes. What could be the issue here? Thanks.

Can you give an example of what you’re trying to do? It’s not clear what you mean by the original length of bytes.

It was resolved, i forgot to close output channel. Thank you!