如何在C代码中将二进制数转换为字母? [英] How to convert binary number to alphabets in C code?

查看:276
本文介绍了如何在C代码中将二进制数转换为字母?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

测试系统的输出是二进制的,这是一个以字母为输入的压缩系统。所以我需要将测试模块的二进制输出转换为字母表,作为压缩系统的输入。



我尝试过:



还没有尝试过任何东西..我已经完成了测试模块和压缩模块。

解决方案

字母是二进制值:一切都与计算机有关,它只是我们人类放在顶部的解释层,即这是文本,这是浮点数,这是指向结构的指针。

所以这不仅仅是做这个,它会工作的情况。

你将不得不看看进来的数据,以及应该出去的数据,并弄清楚它们之间的相关性。

一个地方可以在这​​里开始: Ascii Table - ASCII字符代码和html,八进制,十六进制和十进制图表转换 [ ^ ] - 它是你可能获得的各种二进制字节值的映射,通常被解释为文本字符。 (ASCII是Unicode的先行者,其中许多可打印的值是相同的,因此它是一个很好的起点)。它可能就像将数据转换为(char *)一样简单 - 我们无法知道。



对不起,但是你将不得不寻找您自己:我们无法访问您的数据,或者您需要将其发送到的系统的任何信息! :笑:

the output from testing system is in binary and this is given to a compression system which takes alphabets as input. so i need to convert the binary output from testing module to alphabets to give as input to compression system.

What I have tried:

Have not tried anything yet..I have done the testing module and compression module.

解决方案

"Alphabets" are binary values: everything is with computers, it's just the "interpretation layer" we humans put over the top that says "this is text", "this is floating point number", "this is a pointer to a struct".
So it's isn't just a case of "do this and it'll work".
You are going to have to look at the data coming in, and the data that should go out, and work out what the correlation between them is.
One place to start is here: Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion[^] - it's a "map" of what the various binary byte values you might be getting are often interpreted as as text characters. (ASCII is the forerunner to Unicode, and many of it's printable values are the same, so it's a good starting point). It may be as simple as casting the data to a (char *) - be we can't know.

Sorry, but you are going to have to look for yourself: we don't have access to your data, or any info about the system you need to send it to! :laugh:


这篇关于如何在C代码中将二进制数转换为字母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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