[2005] ReadAllLines vs NULL
Well, a Happy Friday to everyone,
Should ReadAllLines be renamed to ReadAllLines_unlessThereIsANullValueInTheData???:D
I am trying to read a delimited file in to an array but there happens to be null values in some fields and ReadAllLines stores lines of data up to that point and then carries on losing some data in the process.
Is there a way around this?
Thanks for your help
Gogi
Re: [2005] ReadAllLines vs NULL
Oh,
I am using this.
Code:
Dim Lines As String() = IO.File.ReadAllLines(txtMainFile.Text)
Re: [2005] ReadAllLines vs NULL
When you say "null values" do you actually mean null characters? Null characters indicate the end of a string so it's logical that ReadAllLines would stop reading at that point. You shouldn't have null characters in a text file for that very reason: a null character isn't text; it's the end of text. If you want different behaviour then it's up to you to implement it yourself. You'd have to read the binary data of the file yourself with a FileStream object.
Re: [2005] ReadAllLines vs NULL
Thanks jmcilhinney,
I'll try and do something different - perhaps delete the file and pretend it never was
Gogi