The stream_write() function is used to write to data to imgtool_streams.
UINT32 stream_write(imgtool_stream *stream, const void *buf, UINT32 sz);
stream– Pointer to the imgtool_stream where the data should be written.
buf– Pointer to a buffer with the data.
sz– Amount of bytes to write.
The number of bytes written to the stream.
bytes_written = stream_write(destf, buffer, bytes_left);
bytes_left bytes from the buffer to the imgtool_stream
destf. The actual amount of bytes that were written to the file is returned in the variable bytes_written.