Byte读取文件字节 [英] Read File Byte by Byte

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

问题描述

有人知道在VBA中读取文件的(快速)示例,Byte per Byte?

我需要能够对每个字节采取措施


Thx

解决方案

我想你正在寻找 Get#

FreeFile()打开#放#& 关闭#都是相关的,我建议在开始之前仔细阅读帮助主题。


这是可能的,并且它也可以很好地工作,但它肯定不是处理文件I / O的默认方式,所以不要指望它是直截了当的。


我用它一个bit,因为它在某些情况下是完美的,但通常只有在没有更好的方法来做我需要的时候。


@wquatan


以下代码将打开一个文件(C:\ Windows \ System.ini),读取其内容Byte-by-Byte,显示每个Character的位置,Decimal和Hexadecimal等价物,以及实际角色本身。我发布了部分显示输出供您查看,任何问题,随时可以询问。

展开 | 选择 | Wrap | 行号





谢谢你有趣的例子!!


然而,有一个问题:我无法将整个文件读入一个strBuffer。我必须威胁的文件可能非常大。


我真的需要读取每个字节的字节,直到结束。


THX

Does someone know an (fast) example of reading files in VBA, Byte per Byte ?
I need to be able to take action on every single byte

Thx

解决方案

I think you''re looking for Get#.

FreeFile(), Open#, Put# & Close# are all related and I would recommend a thorough reading of the help topic before starting along these lines.

It''s possible to do, and it can work quite well too, but it''s certainly not the default way of handling file I/O so don''t expect it to be straightforward.

I use it a bit, as it''s perfect for some situations, but generally only when there''s no better way of doing what I need.


@wquatan
The following code will Open a File (C:\Windows\System.ini), read its contents Byte-by-Byte, display each Character''s Position, Decimal and Hexadecimal equivalents, and the actual Character itself. I posted a partial display of the Output for you to see, any questions, feel free to ask.

Expand|Select|Wrap|Line Numbers


Hi,

Thank you for the interesting example !!

However, there is one problem : I''m unable to read the whole file into one strBuffer. The files I have to threat can be very very large.

I really need to read byte per byte till the end is reached.

Thx


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

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