fwrite_bytesT_fwrite_bytesFwriteBytesFwriteBytesfwrite_bytes (Operator)
Name
fwrite_bytesT_fwrite_bytesFwriteBytesFwriteBytesfwrite_bytes
— Write bytes to a binary file.
Signature
Description
The operator fwrite_bytesfwrite_bytesFwriteBytesFwriteBytesFwriteBytesfwrite_bytes
writes bytes to the output
file defined by FileHandleFileHandleFileHandleFileHandlefileHandlefile_handle
.
The output file must have been opened with open_fileopen_fileOpenFileOpenFileOpenFileopen_file
in
binary format.
The data to be written to the file is specified as DataToWriteDataToWriteDataToWriteDataToWritedataToWritedata_to_write
.
The number of bytes that are written to the file is returned in
NumberOfBytesWrittenNumberOfBytesWrittenNumberOfBytesWrittenNumberOfBytesWrittennumberOfBytesWrittennumber_of_bytes_written
.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
FileHandleFileHandleFileHandleFileHandlefileHandlefile_handle
(input_control) file →
HFile, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
File handle.
DataToWriteDataToWriteDataToWriteDataToWritedataToWritedata_to_write
(input_control) integer-array →
HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Data to be written to the file.
NumberOfBytesWrittenNumberOfBytesWrittenNumberOfBytesWrittenNumberOfBytesWrittennumberOfBytesWrittennumber_of_bytes_written
(output_control) integer →
HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Number of bytes written to the output
binary file.
Example (HDevelop)
* Write a binary file byte by byte.
open_file (Filename, 'append_binary', FileHandle)
fwrite_bytes(FileHandle, [0x97, 99, 102], BytesWritten)
close_file (FileHandle)
Result
If an output file is open in binary mode and no file write error occurs,
the operator fwrite_bytesfwrite_bytesFwriteBytesFwriteBytesFwriteBytesfwrite_bytes
returns TRUE. Otherwise, an exception is
raised.
Possible Predecessors
open_fileopen_fileOpenFileOpenFileOpenFileopen_file
Possible Successors
close_fileclose_fileCloseFileCloseFileCloseFileclose_file
Alternatives
fwrite_stringfwrite_stringFwriteStringFwriteStringFwriteStringfwrite_string
See also
open_fileopen_fileOpenFileOpenFileOpenFileopen_file
,
close_fileclose_fileCloseFileCloseFileCloseFileclose_file
,
fread_bytesfread_bytesFreadBytesFreadBytesFreadBytesfread_bytes
Module
Foundation