[Mono-dev] Fwd: BinaryReader Mono 1.9.1 problem

Leszek Ciesielski skolima at gmail.com
Thu Jun 12 07:06:06 EDT 2008


---------- Forwarded message ----------
From: Mario De Clippeleir <mariodc at sydec.be>
Date: Thu, Jun 12, 2008 at 1:04 PM
Subject: RE: [Mono-dev] BinaryReader Mono 1.9.1 problem
To: Leszek Ciesielski <skolima at gmail.com>


Hi,

The problem is with the ReadChars function. All of a sudden it skips
more than it is supposed to. When I use ReadBytes, it works.

Here are the file and some test code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
   class Program
   {

       static void Main(string[] args)
       {
           int nrOfColumns = 0;
           Stream memoryStream = File.OpenRead("test.mix");
           BinaryReader reader = new BinaryReader(memoryStream);
           reader.BaseStream.Position = 0;
           Console.Out.WriteLine(reader.BaseStream.Position);
           char[] chars = reader.ReadChars(4);
           Console.Out.WriteLine(reader.BaseStream.Position);
           string identification = new string(chars);
           Console.Out.WriteLine("identification = " + identification);

           reader.BaseStream.Position = 40;
           nrOfColumns = reader.ReadInt32();
           Console.Out.WriteLine(reader.BaseStream.Position);
           reader.BaseStream.Position = 60;
           for (int i = 0; i < nrOfColumns; i++)
           {
               reader.ReadInt32();
               Console.Out.WriteLine(reader.BaseStream.Position);
               byte[] mixName = reader.ReadBytes(64);
               Console.Out.WriteLine(reader.BaseStream.Position);
               //Console.Out.WriteLine(" mixName= " + new
string(mixName));

           }
       }
   }
}

-----Original Message-----
From: Leszek Ciesielski [mailto:skolima at gmail.com]
Sent: donderdag 12 juni 2008 11:29
To: Mario De Clippeleir
Subject: Re: [Mono-dev] BinaryReader Mono 1.9.1 problem

Please include a test program (preferably with the actual data that
you experience the error with), we can't say much without those.

2008/6/12 Mario De Clippeleir <mariodc at sydec.be>:
> Hi,
>
>
>
> I have a problem where the binaryreader gives the following error :
>
>
>
> System.IO.EndOfStreamException: Failed to read past end of stream.
>
>
>
> I am using mono 1.9.1.
>
>
>
> It works fine in just c#.
>
>
>
> Anybody got any ideas on what this problem may be and how/when it can
be
> resolved ?
>
>
>
> Thanks,
>
>
>
> Mario
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>



--
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0




-- 
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.mix
Type: application/octet-stream
Size: 10668 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080612/4d1ae43a/attachment-0001.obj 


More information about the Mono-devel-list mailing list