Skip to content

write_memory_blockWriteMemoryBlockWriteMemoryBlockwrite_memory_blockT_write_memory_block🔗

Short description🔗

write_memory_blockWriteMemoryBlockWriteMemoryBlockwrite_memory_blockT_write_memory_block — Write a memory block to a file.

Signature🔗

write_memory_block( memory_block MemoryBlockHandle, filename.write FileName )void WriteMemoryBlock( const HTuple& MemoryBlockHandle, const HTuple& FileName )static void HOperatorSet.WriteMemoryBlock( HTuple memoryBlockHandle, HTuple fileName )def write_memory_block( memory_block_handle: HHandle, file_name: str ) -> None

Herror T_write_memory_block( const Htuple MemoryBlockHandle, const Htuple FileName )

Description🔗

The operator write_memory_blockWriteMemoryBlock writes the byte content of the memory block MemoryBlockHandlememoryBlockHandlememory_block_handle to the file FileNamefileNamefile_name. The memory block can be read again with read_memory_blockReadMemoryBlock.

The default HALCON file extension for memory block files is '.bin', but any file extension can be chosen, including none.

Attention🔗

Choosing a file extension that does not fit the byte content of the memory block MemoryBlockHandlememoryBlockHandlememory_block_handle only changes the name of the file, not the bytes written to disk.

Execution information🔗

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🔗

MemoryBlockHandlememoryBlockHandlememory_block_handle (input_control) memory_block → (handle)HTuple (HHandle)HMemoryBlock, HTuple (IntPtr)HHandleHtuple (handle)

Memory block handle.

FileNamefileNamefile_name (input_control) filename.write → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the file.

Default: 'memory_block.bin'"memory_block.bin"
File extension: .bin

Result🔗

The operator write_memory_blockWriteMemoryBlock returns the value 2 (H_MSG_TRUE) if the passed handle is valid and if the memory block was successfully written into the named file. Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

create_memory_block_externCreateMemoryBlockExtern, create_memory_block_extern_copyCreateMemoryBlockExternCopy, image_to_memory_blockImageToMemoryBlock

See also

read_memory_blockReadMemoryBlock

Module🔗

Foundation