Pastebin

Paste #2414: fpc read file

< previous paste - next paste>

Pasted by tdn

Download View as text


procedure TForm1.Button3Click(Sender: TObject);
Var Fin, fout : File;
    NumRead,NumWritten : Word;
    Buf : Array[1..2048] of byte;
    Total : Longint;
begin
  Assign (Fin, Form1.LabeledEdit2.Text);
  Reset (Fin,1);
  Total:=0;
  Repeat
    BlockRead (Fin,buf,Sizeof(buf),NumRead);
    inc(Total,NumWritten);
  Until (NumRead=0) or (NumWritten<>NumRead);
  Write ('Copied ',Total,' bytes from file ',paramstr(1));
  close(Fin);
end;           

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.