Link to home
Create AccountLog in
Avatar of Matrix1000
Matrix1000

asked on

Streamreader works fine in Vista, but not in XP?

I've got a text file reader that seems to parse the entire file into the richtextbox on my dev environment in Vista but when installed on an XP box it doesn't go to the end of the file. It stops around line 25414.

What could be the problem?
Dim objReader As New System.IO.Streamreader(FILE_NAME)
Dim ChildForm As frmMainChildForm = CType(Me.ActiveMdiChild, frmMainChildForm)
ChildForm.RichTextBox1.Text = objReader.ReadToEnd
objReader.Close()

Open in new window

Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

How much memory do you have on the XP machine?
You may have run out of memory on the XP machine.
Avatar of Matrix1000
Matrix1000

ASKER

I have a new Dell workstation with 4 GB Ram. Hmmmmm. This is a real bummer....
Notepad and Wordpad seem to be able to open it just fine.
What is the size of the File?
Most text files are between 3 and 5 MB. This one is 3.6 MB
Weird, I opened up the file in notepad and there is a line beginning with "¿«ÑGttyS0" with a whole bunch of lines after it that are just blank. I opened it up in TextPad and it displays " ¿«ÑGttyS0 ||||||||||||||||||||||||||||||||>for a long way then when I try to copy the line to paste it into here it says "Cannot cut, copy, or drag ad drop text containing null (code=0) characters.

How do I prepare my streamreader for that? There are thousands of valid lines after that one that I need to read.
Well if this is a standard text it should not have those characters in them. Is this the same file you used on the Vista machine and it worked or is this another file?
What happens when you try it this way?

    ChildForm.RichTextBox1.Text = System.Text.Encoding.Default.GetString(My.Computer.FileSystem.ReadAllBytes(FILE_NAME))
FernandoSoto: No its different but I just tired it with the same exact file and the results were the same on both machines... it stopped where the null characters begin. It seems that notepad just creates a bunch of non selectable whitespace but still continues to read the  contents of the file after the null characters.

Idle_Mind: Hmm still stops at that line. I wonder why, if its not the end of the file.
SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Yes. Its a Linux based diagnostic output file.
Thanks for the Link!
Thanks for your answers.
Fernando: can you take a look at this for me?
https://www.experts-exchange.com/index.jsp?qid=23230785