Pastebin
Paste #2414: fpc read file
< previous paste - next paste>
Pasted by tdn
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
Go to most recent paste.