hi
i've finished my simple pack editor , now my pack class member (getfile)function return a just a pointer of memory file , i use it with D3DX9 when loading texture or x files .

int the 2nd version i want to add a memoryStream class , so i can read files in memory manualy .

the problem is my memclass give wrong results

Code:
type
   PByteArray = ^TByteArray;
   TByteArray = array[0..32767] of Byte;

   MemStream = Object
   public
    procedure ReadMem(var buf ; _size :integer; count:DWORD);
    procedure SetMemPos(_indx : integer);
     
   public
    data : pointer;
    _pointer : integer ;
   end;

implementation

procedure MemStream.ReadMem(var buf; _size: integer; count: DWORD);
var i ,j,L: integer;

begin

  L := _size * count;
   for i := _pointer to L do
    begin
      Pbyte(buf)^ := PbyteArray(data)[i]^;
      inc(Pbyte(buf));
    end;
    _pointer := L;

end;

procedure MemStream.SetMemPos(_indx: integer);
begin
  _pointer := _indx;
end;
could any body detect where is the bug !!

thanks in advance