换行到CrLf [英] Linefeed to CrLf

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

问题描述

我正在接收来自unix sustem的文本文件中的数据,onlu将每行末尾的Lf字符放入

。访问坚持Cr或CrLf

或它将文件视为1行700Kb宽和扼流圈。


是否有更好的方法导入此文件而不是使用打开#1

命令并在do循环中构建字符串一次一个字符?


-

Bob Quintal


PA是我已经改变了我的电子邮件地址。


-

通过免费发布来自 http://www.teranews.com 的Usenet帐户

I''m receiving data in text files from a unix sustem that onlu puts
a Lf character at the end of each row. Access insists on Cr or CrLf
or it sees the file as 1 row 700Kb wide and chokes.

Is there a better way of importing this file than using the open #1
command and building strings in a do loop one character at a time?

--
Bob Quintal

PA is y I''ve altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

推荐答案

2007年3月9日21:26:51 GMT,Bob Quintal< rq ****** @ sPAmpatico.ca>

写道:


所以你在导入之前编写一些代码来预处理文件,

用CRLF代替CR。

-Tom。

On 09 Mar 2007 21:26:51 GMT, Bob Quintal <rq******@sPAmpatico.ca>
wrote:

So you write some code to pre-process the file before importing it,
replacing CR with CRLF.
-Tom.


>我正在接收来自unix sustem的文本文件中的数据,即onlu将
一个Lf角色在每一行的末尾。访问坚持Cr或CrLf
或者它看到文件为1行700Kb宽和扼流圈。

有没有比使用开放#1更好的导入此文件的方式
命令和构建字符串一次循环一个字符?

- 鲍勃昆塔尔

PA是我改变了我的电子邮件地址。
>I''m receiving data in text files from a unix sustem that onlu puts
a Lf character at the end of each row. Access insists on Cr or CrLf
or it sees the file as 1 row 700Kb wide and chokes.

Is there a better way of importing this file than using the open #1
command and building strings in a do loop one character at a time?

--
Bob Quintal

PA is y I''ve altered my email address.


Bob Quintal写道:
Bob Quintal wrote:

我正在接收来自a的文本文件中的数据unix sustem thatlu put

a Lf字符在每一行的末尾。访问坚持Cr或CrLf

或它将文件视为1行700Kb宽和扼流圈。


是否有更好的方法导入此文件而不是使用打开#1

命令并在do循环中构建字符串一次一个字符?
I''m receiving data in text files from a unix sustem that onlu puts
a Lf character at the end of each row. Access insists on Cr or CrLf
or it sees the file as 1 row 700Kb wide and chokes.

Is there a better way of importing this file than using the open #1
command and building strings in a do loop one character at a time?



函数ReadAll(path As String)As字符串

Dim fh As Long

fh = FreeFile

Dim s As String

''添加错误处理

打开二进制路径为#fh

s = String


Function ReadAll(path As String) As String
Dim fh As Long
fh = FreeFile
Dim s As String
''add error handling
Open path For Binary As #fh
s = String


(LOF(fh),vbNullChar)

获取#fh ,, s

关闭fh


ReadAll = s

结束功能


子测试()

Debug.Print替换(ReadAll(" c:\ bigFile.txt"),vbLf,vbCrLf)

End Sub
(LOF(fh), vbNullChar)
Get #fh, , s
Close fh

ReadAll = s
End Function

Sub test()
Debug.Print Replace(ReadAll("c:\bigFile.txt"), vbLf, vbCrLf)
End Sub


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

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