在VC ++中生成带有奇怪字符的二进制字符串 [英] generating a binary string with weird character in VC++
本文介绍了在VC ++中生成带有奇怪字符的二进制字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不使用二进制编写器需要根据VC ++中的某些十六进制数据30303054313032202020303030生成带有奇怪字符的二进制字符串
输入十六进制:5430323120302030302030
输出:6? ? ? ? ? ?
Without using binary writer need to generate a binary string with weird character based on some hex data "30303054313032202020303030" in VC++
Input Hex:5430323120302030302030
Output :6
推荐答案
在我看来,这样的字符串不代表奇怪的字符(它代表以下字符序列000T102 000
)。
您必须:
- 将字符串转换为
unsigned char
的数组s(字符串的每个有序字符串代表unsigned char
)- 将unsigned char数组写入二进制文件(例如,使用
fwrite
function(或ofstream :: write
方法)。
Such a string does not represent ''weird characters'', in my opinion (it represents the following character sequence"000T102 000"
).
You have to:
- convert the string into an array of
unsigned char
s (each ordered pair of characters of your string represent anunsigned char
)- write the unsigned char array to a binary file (using, for instance
fwrite
function (orofstream::write
method).
这篇关于在VC ++中生成带有奇怪字符的二进制字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文