Click to See Complete Forum and Search --> : Weird Problem with ReadAll method


geniusidler
September 15th, 2001, 11:05 AM
Hi,

I wrote a simple function to read data from a text file:

Dim buffer as string
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(filename, ForReading, -2)
buffer = f.Readall
f.Close

The weird thing is an extra newline character for every row of data is always added for no apparent reason. Example:

Source File:
123456
1234567890

Buffer: "123456nn1234567890" where n=newline character

Anybody know why?

Any input is greatly appreciated!

Rgs
WT

geniusidler
September 15th, 2001, 11:17 AM
Sorry, make a mistake, it problem should be extra space padded for every row of data.

Source:
123456
1234567890

buffer: "123456ns1234567890" where n=newline s=whitespace

Sorry about that.

WT