By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

BinaryReader C# Problem

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
* my*********@yahoo.com (mike) scripsit:
[...]

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

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
Cor
Hi Mike,

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

I hope this helps

Cor
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.