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.

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));

 

           }

       }

   }

}

 

Attachment: test.mix
Description: test.mix

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to