基于二进制和基于ASCII的文件比较有什么区别? [英] What is the difference between binary and ASCII based file comparison?

查看:81
本文介绍了基于二进制和基于ASCII的文件比较有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在Windows中使用像 fc 这样的文件比较工具,则可以在ASCII比较和二进制比较之间进行选择.

If I use a file comparison tool like fc in Windows, you can choose between ASCII and binary comparison.

这两个比较之间的实际区别是什么?如果我比较两个ASCII文件,是否不希望文件的二进制数据相同?

What is the actual difference between these two comparisons? If I compare two ASCII files, don't I want the binary data of the files to be identical?

推荐答案

警告:这是5岁的uni知识的松散回忆

WARNING: this is 5 year old loose remembrance of knowledge from uni

二进制表示意味着您完全比较二进制,而ascii是数据类型的比较.简而言之,char'A'表示01000001,但这也是一个等于'65'的8位整数,因此意味着A = 65(二进制).因此,如果您将A + A作为字符串和65 43 65(二进制到十进制为43是"+"),则在二进制中它们是等效的,但在ascii中则不是.这是一个非常宽松的解释,我敢肯定我错过了很多,但这应该可以概括起来.

Binary representation means you compare the binary exactly, and ascii is a comparison of data type. to put it in a simple case the char 'A' is a representation of 01000001, but that is also an 8 bit integer equal to '65', so that means A = 65 in binary. so if you were doing A + A as a string and 65 43 65 (43 is '+' in binary to decimal), in binary they would be equivalent, but in ascii they would not. This is a very loose explanation and i'm sure i missed a lot, but that should sum it up loosely.

在文本文件中,您需要ASCII,因为您以ASCII字符编写.也就是说,程序状态保存到您要二进制文件进行直接比较的文件中.

In a text file you want ASCII because you write in ascii characters. In say, a program state saved to a file you want binary to get a direct comparison.

这篇关于基于二进制和基于ASCII的文件比较有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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