Results 1 to 2 of 2
2003-03-08, 10:11 #1
- Join Date
- Feb 2001
- Yilgarn region of Toronto, Ontario
- Thanked 0 Times in 0 Posts
( Line Input ) Run time error '14' - Out Of String
I was amazed to see, this morning, that Line Input fails when trying to read the first line of a large (36MB) comma-delimited text file.
There are more than 65K lines in the file, so a cheap Import into Excel fails. Access barfs on the first line (but I really think it's a different problem, because Access barfed on the first line of a different file (12MB) but Excel managed to read 32K lines of it.
Why should LINE INPUT throw up its hands? I thought it might read a buffer of, perhaps, 64K and then parse the lines out of that.
In the code sample below I have disabled the offending lines. The new lines (for Binary Read) work, returning a gob of text each time, which, presumably, I must break into lines, and then parse.
A pox on Line Input!
Dim intFile As Integer
intFile = FreeFile
Dim strFilename As String
strFilename = "C:GreavesProductsGeographyNAmericaUSACaliforniaCA _deci.txt"
' Open strFilename For Input As #intFile
Open strFilename For Binary As #intFile
While Not EOF(intFile)
Dim strLine As String
' Line Input #intFile, strLine
strLine = Input(1024, intFile)
2003-03-08, 15:21 #2
- Join Date
- Dec 2000
- Sacramento, California, USA
- Thanked 1 Time in 1 Post
Re: ( Line Input ) Run time error '14' - Out Of String
Have you tried declaring strLine as a specific length string so that you process the text in manageable chunks?Charlotte