情報詳細Q:C++のprintf()でtupleの値を表示しようとしましたが変な値が表示されます。A:HALCONのtupleはHTuple型で定義されています。C++でtupleにアクセスするには以下のフォーマットに従います。アクセスする変数の型によって .D()(実数) .L()(整数) .S()(文字列) の型指定をtupleの後に付ける必要があります。以下、HALCON C++ユーザマニュアルの図2.9からの抜粋です。#include "HalconCpp.h"#includemain (){HTuple t;cout << t.Num() << '\n'; // The length of the tuple is 0t[0] = 0.815; // Assigning values to the tuplet[1] = 42;t[2] = "HAL";cout << t.Num() << '\n'; // The length of the tuple is 3cout << "HTuple = " << t << '\n'; // Using the << operatordouble d = t[0]; // Accessing the tuple, if thelong l = t[1]; // the types of the elementschar *s = t[2]; // are known// Accessing the tuple, if the types of the elements are not knownprintf("Values: %g %ld %s\n",t[0].D(),t[1].L(),t[2].S());}添付ファイルタイトルtuple要素にアクセスURL 名000005948公開状況公開済み検証状況公開済み