CRC检查文件 [英] CRC checks for files

查看:135
本文介绍了CRC检查文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个小型的FAT16文件系统,我想为存储配置信息的个别XML文件生成CRC值。如果数据改变或损坏,我希望能够检查CRC,以确定该文件仍处于它的原始状态。



问题是,如何是否将CRC值存入文件,而不改变文件本身的CRC值?我可以考虑一些解决方案,但我认为这个问题必须有一个相当标准的解决方案。

CRC值到文件末尾。然后,在稍后计算CRC值进行检查时,省略最后四个字节。


I'm working with a small FAT16 filesystem, and I want to generate CRC values for indidual XML files which store configuration information. In case the data changes or is corrupted, I want to be able to check the CRC to determine that the file is still in it's original state.

The question is, how do I put the CRC value into the file, without changing the CRC value of the file itself? I can think of a couple solutions, but I think there must be a fairly standard solution for this issue.

解决方案

You could append the CRC value to the end of the file. Then, when computing the CRC value later for checking, omit the last four bytes.

这篇关于CRC检查文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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