BinaryReader C# Problem

M

mike

I'm reading in a text file 602 bytes at a time, using the code below.
One of the lines has text that looks like this: "Cell#+9 and
more text here going to 602 characters for each line."

For some reason when this line is encoded the +9 is gone and
everything is moved to the left 2 bytes.

How can I get around this.

byte[] buff = new byte[602];

// Create the reader for data.
FileStream fs = new FileStream(filename, FileMode.Open,
FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
buff=r.ReadBytes(602);
line = System.Text.Encoding.ASCII.GetString(buff as
System.Byte[]);

I have also tried
System.Text.Encoding.UTF7.GetString(buff as System.Byte[]); with the
same result
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (mike) scripsit:
[...]

Why do you post a C# question to /this/ group?!
 
C

Cor

Hi Mike,

The Csharp newsgroup is two flours higher just above the Jscript newsgroup

I hope this helps

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top