j:=(m.Size div 32768)
if (m.Size mod 32768) <> 0 then
  j := j + 1;
是不是这句有问题?//少了最后一位!
    

解决方案 »

  1.   

    to:genphone_ru
    不是这个问题,j:=(m.size div 32768)将得到小文件的个数。i从0到j的循环是正确的,当
    然,这样的写法在文件大小正好是32K的整数倍时将导致错误。但因为我以上的代码是原型
    试验所以也就没在这个问题上做太多的处理。
    to all
    大家讨论不是很踊跃呀。甭管对错,切磋一下才能共同进步呀。
      

  2.   

    我简单的看了一下  
      while i<=j do
        begin
              n:=tmemorystream.Create;//这句是否应放到循环的外面
              n.LoadFromFile('c:\'+copy(inttostr(i+1000),2,3)+'.cut');
              //添上n.Poestion:=0;另外tmemorystream有没有Clear之类的过程,调用一下
              move(n.memory^,m.memory^,n.size);
              inc(i);
              n.free;//放到循环的外面
        end;
        
      

  3.   

    to all
    呵呵,从大富翁www.delphibbs.com上已经问出答案了。但却不是象楼上几位兄弟说的。:)有人能正确回答吗?有正确答案的给80%的分数,没正确答案人人有分。算是有奖测验啦。
    等待一天,答案明天公布。
      

  4.   

    MOVO确实有问题,换成READ和WRITE就好了。主要问题在于READ和WRITE以后将使流的指针
    移动。以下是VCL中READ的函数原型function TCustomMemoryStream.Read(var Buffer; Count: Longint): Longint;
    begin
      if (FPosition >= 0) and (Count >= 0) then
      begin
        Result := FSize - FPosition;
        if Result > 0 then
        begin
          if Result > Count then Result := Count;
          Move(Pointer(Longint(FMemory) + FPosition)^, Buffer, Result);//复制字节
          Inc(FPosition, Result);   //移动指针
          Exit;
        end;
      end;
      Result := 0;
    end;