Operator Reference

write_tuplewrite_tupleWriteTupleWriteTuplewrite_tuple (Operator)

write_tuplewrite_tupleWriteTupleWriteTuplewrite_tuple — Write a tuple to a file.

Signature

write_tuple( : : Tuple, FileName : )

Herror write_tuple(double Tuple, const char* FileName)

Herror T_write_tuple(const Htuple Tuple, const Htuple FileName)

void WriteTuple(const HTuple& Tuple, const HTuple& FileName)

static void HMisc::WriteTuple(const HTuple& Tuple, const HString& FileName)

static void HMisc::WriteTuple(const HTuple& Tuple, const char* FileName)

static void HMisc::WriteTuple(const HTuple& Tuple, const wchar_t* FileName)   ( Windows only)

void HTuple::WriteTuple(const HTuple& FileName) const

static void HOperatorSet.WriteTuple(HTuple tuple, HTuple fileName)

static void HMisc.WriteTuple(HTuple tuple, string fileName)

void HTuple.WriteTuple(HTuple fileName)

def write_tuple(tuple: MaybeSequence[Union[float, int, str]], file_name: str) -> None

Description

The operator write_tuplewrite_tupleWriteTupleWriteTuplewrite_tuple writes the contents of TupleTupleTupletupletuple to a file. The data is written in an ASCII format. Therefore, the file can be exchanged between different architectures (see also Tuple / String Operations). The default HALCON file extension for the tuple is 'tup'.

Exception: Handles

Note that write_tuplewrite_tupleWriteTupleWriteTuplewrite_tuple does not support handles, since binary data is not supported by the underlying ASCII format. Any handle contained in TupleTupleTupletupletuple is replaced by the integer 0. To write a tuple that contains handles, use serialize_tupleserialize_tupleSerializeTupleSerializeTupleserialize_tuple and fwrite_serialized_itemfwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_item.

Execution Information

  • Multithreading type: independent (runs in parallel even with exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

TupleTupleTupletupletuple (input_control)  tuple(-array) HTupleMaybeSequence[Union[float, int, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Tuple with any kind of data.

FileNameFileNameFileNamefileNamefile_name (input_control)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of the file to be written.

File extension: .tup

Result

If the parameters are correct the operator write_tuplewrite_tupleWriteTupleWriteTuplewrite_tuple returns the value 2 ( H_MSG_TRUE) . Otherwise an exception is raised.

Alternatives

fwrite_stringfwrite_stringFwriteStringFwriteStringfwrite_string

See also

read_tupleread_tupleReadTupleReadTupleread_tuple, write_imagewrite_imageWriteImageWriteImagewrite_image, write_regionwrite_regionWriteRegionWriteRegionwrite_region, open_fileopen_fileOpenFileOpenFileopen_file

Module

Foundation