https://bugzilla.novell.com/show_bug.cgi?id=399959


           Summary: BinaryReader : ReadChars problem
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Keywords: Code
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


I am using Mono 1.9.1.
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.
The ReadChars(64) is supposed to be on position 128, but it is on 136.

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);
               char[] mixName = reader.ReadChars(64);
               Console.Out.WriteLine(reader.BaseStream.Position);
               //Console.Out.WriteLine(" mixName= " + new
string(mixName));

           }
       }
   }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to