如何读取没有CR / LF的大文本文件以便我可以添加换行符? [英] How to read in a large text file that has no CR/LF so that I can add linefeeds?

查看:76
本文介绍了如何读取没有CR / LF的大文本文件以便我可以添加换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FileSystemObject来执行此操作,但由于某种原因,它突然开始向我提供错误的数据。我在Access 2003,VBA代码中工作,需要解析没有回车符或换行符的大数据文件。一个代字号位于我放入换行符的位置并将该行输出到一个新文件。


我不知道为什么FSO突然开始给我不好的数据。我可以用ASCII查看器查看文件,看看文件数据是否正常。


多年来我还没有尝试使用二进制数据文件而且没有'''我知道这是否是我必须回归的原因。线路输入不起作用,因为没有换行符。


感谢您的帮助,你可以给我!

I was using FileSystemObject to do this, but for some reason it has suddenly started giving me bad data. I am working in Access 2003, VBA code and need to parse large data files that come in with no carriage return or linefeed characters. A tilde is in the spot where I put in a linefeed and output the line to a new file.

I don''t know why FSO has suddenly started giving me bad data. I can look at the file with an ASCII viewer and see that the file data is good.

I haven''t tried to work with binary data files for many years and don''t know if that is what I have to fall back to or not. Line Input doesn''t work, as there are no line breaks.

Thanks for any help you can give me!

推荐答案

这是我的头脑,所以我实际上没有运行代码。它将创建一个新的文本文件,其中〜已被回车换行替换。
This is of the top of my head, so I havent actually run the code. It will create a new textfile, where ~ has been replace by carriage return linefeed.
展开 | 选择 | Wrap | 行号


感谢您的快速回复!我正在使用你的想法,但在行上出错:f1.Write strContent

错误是:无效的程序调用或参数


我正在寻找有关FSO函数的定义...
Thank you for the quick reply! I am using your idea, but getting an error on the line: f1.Write strContent
The error is: Invalid procedure call or argument

I am looking for a definition of the FSO functions...


您是使用发布的代码,还是进行了修改?您是否将引用设置为Windows脚本宿主对象模型?
Are you using the code as posted, or have you made modifications? Do you have a reference set to the "Windows Script Host Object Model"?


这篇关于如何读取没有CR / LF的大文本文件以便我可以添加换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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