====== stream_write() ======
----
The **stream_write()** function is used to write to data to [[imgtool_streams]].
===== Syntax =====
----
==== Declaration ====
Declared in ''src/mess/tools/imgtool/stream.h'' as
UINT32 stream_write(imgtool_stream *stream, const void *buf, UINT32 sz);
==== Parameters ====
* ''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.
==== Returns ====
The number of bytes written to the stream.
===== Example =====
----
bytes_written = stream_write(destf, buffer, bytes_left);
Writes ''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.