|
-
Aug 17th, 2007, 05:20 AM
#1
Thread Starter
Member
[2005] ReadAllLines vs NULL
Well, a Happy Friday to everyone,
Should ReadAllLines be renamed to ReadAllLines_unlessThereIsANullValueInTheData???
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
-
Aug 17th, 2007, 05:26 AM
#2
Thread Starter
Member
Re: [2005] ReadAllLines vs NULL
Oh,
I am using this.
Code:
Dim Lines As String() = IO.File.ReadAllLines(txtMainFile.Text)
-
Aug 17th, 2007, 05:29 AM
#3
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.
-
Aug 17th, 2007, 05:43 AM
#4
Thread Starter
Member
Re: [2005] ReadAllLines vs NULL
Thanks jmcilhinney,
I'll try and do something different - perhaps delete the file and pretend it never was
Gogi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|