读取和写入大文本文件的最后几个字节 [英] Read and write last few bytes of a large text file

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

问题描述

嗨朋友们,


我正在尝试使用VB获取最后50 Mb的大文本文件(超过2 GB)。我必须将其添加到Access表单中,以便当用户单击该按钮时,弹出窗口会询问文本文件的来源和输出文件的目标,然后它只将最后50 MB的文件保存到输出位置。我在VB编程方面不是很好。我很感激,如果有人可以帮我这个吗?



谢谢,


亚瑟

Hi Friends,

I am trying to get the last 50 Mb of a large Text file(Over 2 GB) using VB. I have to add this to an Access form so that when the user clicks the button a pop up window asks for the source of the text file and the destination of the output file and then it saves only the last 50 MBytes of the file to the output location. I am not that good in VB programming. I would appreciate if anyone can help me on this?


Thanks,

Arthur

推荐答案

到目前为止你管理的是什么亚瑟?


我很乐意提供帮助 - 但我不认为自己在舀勺。你需要检查帮助文件等,但我可以指出你在哪里看。
What have you managed so far Arthur?

I''m happy to help - but I don''t see myself spoonfeeding. You will need to be checking help files etc, but I can point you at where to look.



你到目前为止管理了什么Arthur ?


我很乐意提供帮助 - 但我不认为自己在喂食。你需要检查帮助文件等,但我可以指出你在哪里看。
What have you managed so far Arthur?

I''m happy to help - but I don''t see myself spoonfeeding. You will need to be checking help files etc, but I can point you at where to look.



您好Neopa,


感谢您的帮助。我试图只获得一个大文件的最后50 MB。我阅读了很多关于使用vb读取和写入文件的文章,并创建了一个程序。问题是,当我尝试运行它时,我遇到溢出错误。我认为它是因为巨大的文件大小(超过2 Gb)而且因为我试图将整个内容都放在一个字符串中。我知道字符串数据类型有一些限制。我的意思是帮助并不代表我需要勺子喂食。我需要的是某种建议,指导,或者即使您可以建议我查看材料。我来到像您这样的专家作为最后的手段并得到一些指导。我感谢您为我以前的帖子提供的所有帮助,我很高兴像您这样的专家花费宝贵的时间来指导像我这样的人。我知道应该有一些其他有效的方法来获取数据。我将非常感谢您或此处的任何其他专家提供的任何帮助。我附上下面的代码。


谢谢和问候,


亚瑟



Hi Neopa,

Thanks for your help. I am trying to get only the last 50 MB''s of a large file. I read a lot of articles about reading and writing into files using vb and have created a program. The problem is that when I try to run it I get an overflow error. I think its because of the huge file size(more than 2 Gb) and also because I am trying to get the entire contents in a string. I know a string datatype has some limitations. What I meant help doesn''t mean that I need spoonfeeding. What I need is some kind of advice, guidance or even if you could suggest me materials to look at. I have come to experts like you as a final resort and to get some guidance. I appreciate all your efforts to help me with my previous post and Im glad that experts like you spend their precious time to guide people like me. I know that there should be some other efficient way of getting that data. I would appreciate any kind of help from you or any of the other experts here on this. I am attaching the code below.

Thanks and regards,

Arthur


展开 | 选择 | Wrap | 行号


字符串变量有2个gig限制。因此,如果您的文件是2演出+,则存在溢出问题。


我在确切的语法上有点生疏,但是有一种方法可以输入文件的一部分在一个设定点(例如,字符为1,000,000)。如果您想要的只是最后一点,那么将整个文件吸入您的变量是没有意义的。


您非常接近使用LOF,所以我会在Google上使用LOF输入VBA看看会出现什么。
The string variable has a 2 gig limitation. So if your file is 2 gigs +, there is your overflow problem.

I''m a little rusty on the exact syntax, but there is a way to input part of the file beginning at a set point (at character 1,000,000 for example). If all you want is the last bit, there is no point in sucking in the entire file into your variable.

You are pretty close using the LOF so I would Google on LOF Input for VBA to see what shows up.


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

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