使用 C++ 中的 cout 以十六进制格式打印 OpenCL cl_uchar?
我正在尝试验证我的指针是否就位,并且想以十六进制格式打印 cl_uchar(无符号字符 OpenCL 类型)的值。我尝试过:
cout << “数据矩阵0,3 =”<< clMatrixPerm->data_matrix->elements[4] << endl;
和
cout << “数据矩阵0,3 =”<<十六进制 << clMatrixPerm->data_matrix->elements[4] << endl;
其中 clMatrixPerm->data_matrix->elements[4] 是要打印的数组中的数据。在这两种情况下,数据矩阵 0,3 =
之后都没有输出。我能够使用 printf 的解决方法,因此我知道数据已正确分配,但如果可能的话,我想使用 cout 打印它。
I'm trying to verify my pointers are in place and I'd like to print the value of a cl_uchar
(unsigned char OpenCL type) in hex format. I tried:
cout << "Data matrix 0,3 = " << clMatrixPerm->data_matrix->elements[4] << endl;
and
cout << "Data matrix 0,3 = " << hex << clMatrixPerm->data_matrix->elements[4] << endl;
where clMatrixPerm->data_matrix->elements[4]
is the data in the array to be printed. In both cases there was no output after Data matrix 0,3 =
. I was able to use a workaround with printf so I know the data is being assigned correctly, but I'd like to print it using cout if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的
Simple