如何显示0x00? [英] How do I display 0x00?

查看:136
本文介绍了如何显示0x00?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用SetWindowText(),AfxMessageBox()或类似内容的对话框中显示嵌入了0x00的数组的内容。



示例数组

unsigned char y [] = {0x21,0x00,0x21};



我遇到的问题是数组的内容被视为CString,因此只显示第一个元素而不是整个数组。使用嵌入式0x00显示整个阵列的正确方法是什么?谢谢。

I would like to display the contents of an array, with a "0x00" embedded, in a dialog using SetWindowText(), AfxMessageBox(), or something similar.

Example Array
unsigned char y[] = {0x21, 0x00, 0x21};

The issue I am having is that the contents of the array are being treated as a CString and so only the first element is being displayed instead of the entire array. What is the correct way to display the entire array with an embedded 0x00? Thanks.

推荐答案

您必须使用正确的格式化程序选项并将其格式化为字符串。喜欢那个



You must use the right formatter options and format it as a string. Like that

text.Format("0x%2X", theByte);





阅读文档



Read the documentation


这篇关于如何显示0x00?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆