读取文件头 [英] Reading header of file

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

问题描述


有什么方法可以读取文件头以获取有关该文件的信息?
谢谢.

Hi,
Is there any way to read file header to get information about that file?
Thanks.

推荐答案

如果您的意思是文件头,通常是存储在某些文件开头的内容,例如PNG,ZIP,GZ等.忽略此解决方案.如果您打算读取文件元信息,请参见: http://msdn.microsoft. com/en-us/library/system.io.file.aspx [ ^ ].仔细了解以Get ...开头的方法,因为它们将为您提供从文件创建时间到ACL信息的所有内容.

最好的问候,

-MRB
If you really mean file header in the sense of stuff that is usually stored at the beginning of some files as in PNG, ZIP, GZ etc. please ignore this solution. If your intend to read file meta info the look here: http://msdn.microsoft.com/en-us/library/system.io.file.aspx[^]. Have a closer look at the method starting with Get... as they will give you everything from file creation time to ACL information.

Best Regards,

-MRB


存在(这当然取决于具有标题的文件).将文件读入字节数组,然后分析字节.不同的文件类型在文件的开头具有不同的签名,因此您需要检查与期望的偏移量相对应的字节.

在不了解您的要求的情况下,不可能做得更多.
There is (this of course depends on the file having a header). Read the file into a byte array and then analyse the bytes. Different file types have different signatures at the start of the file, so you need to check the bytes at the appropriate offsets against the ones you expect.

Without knowing much more about your requirements it''s impossible to go into much more detail.


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

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