可能是filewrite有写入文件大小的限制吧

解决方案 »

  1.   

    代码如下:
    procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
      BufferLength: Word);
    var
      i:integer;
    begin
    if incept=false then
    begin //下载文件
      viewstring:='';
      move(buffer^,pchar(@rbuf)^,bufferlength);
      for i:=1 to bufferlength do
          viewstring:=viewstring+rbuf[i];
      if length(viewstring)=2 then
         begin
           if viewstring='@$' then
              begin
                label1.Caption:='握手成功!现在开始下载文件列表......';
                label1.Repaint;
                sleep(1500);
                senddata1();
              end;
           if viewstring='%<' then
              begin
                label1.Caption:='收到下载请求符!现在开始下载数据......';
                label1.Repaint;
                senddata();
              end;
         end;
    end
    else
    begin  //接收文件
      viewstring:='';
      move(buffer^,pchar(@rbuf)^,bufferlength);
      for i:=1 to bufferlength do
          viewstring:=viewstring+rbuf[i];
      if inceptfilehandle<>-1 then
         begin
           if filewrite(inceptfilehandle,rbuf,bufferlength)=-1 then
              application.MessageBox(pchar('写文件出错'),'错误提示',0);
         end;
    end;
    end;
      

  2.   

    to:
     cg1120(代码最优化) 
    后来我改为逐个字符写入,但还是不成功啊,文件操作功能比C差多了
      

  3.   

    up up down down
    left left right right
    up up down down 
    left left right right 
    up down up down
    left right left right
    up down up down
    left right left right
      

  4.   

    up up down down
    left left right right
    up up down down 
    left left right right 
    up down up down
    left right left right
    up down up down
    left right left right
      

  5.   

    好好看看了,有一些Buffer的了
    function FileWrite(Handle: Integer; const Buffer; Count: LongWord): Integer;
    begin
      if not WriteFile(THandle(Handle), Buffer, Count, LongWord(Result), nil) then
        Result := -1;
    end
      

  6.   

    to:
       dudunono(charly) 
    FileWrite函数本来就是调用WriteFile这个函数的,对这个问题的解决有什么帮助呢?
      

  7.   

    Buffer的下标应该好像是从 0 到 BufferLength-1吧
      

  8.   

    我也曾经遇到过,然后就用了自己的一个Dll负责写文件,
    如果你需要可以发给你。
      

  9.   

    to:
       liujc(阿聪)
    在这里是从1开始的
      

  10.   

    或者你在C下面写一个Dll,然后给Delphi调用不就行了。
      

  11.   

    或许是个解决方法,但delphi不会连这个问题都解决不了吧
      

  12.   

    to 
      anxue,我的邮箱[email protected]