Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function SaveToFile;
  2.   var
  3.   Cnt :integer ;
  4.   begin
  5.     Cnt:=0;
  6.     AssignFile(F, HeadInfo.FileName);
  7.     ReWrite(F, 1);
  8.     // Seek(F, WriteCnt);
  9.     try
  10.       SetLength(FileBuf, HeadInfo.FileLen);
  11.       While  WriteCnt < HeadInfo.FileLen do
  12.         begin
  13.           cnt:=ClientSocket1.Socket.ReceiveBuf(FileBuf[0], HeadInfo.FileLen);
  14.           if cnt = 0 then continue;
  15.           BlockWrite(F, FileBuf[0], Cnt);
  16.           WriteCnt:=WriteCnt+Cnt;
  17.         end;
  18.  
  19.    
  20.     finally
  21.       CloSeFile(F);
  22.       SetLength(FileBuf, 0);
  23.    
  24.      end;
  25.  
  26. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement