Re: Read binary files


Posted by Jean Claude Servaye on September 04, 2000 at 22:51:50:

In Reply to: Read binary files posted by Jan Nyman on September 04, 2000 at 02:57:27:

: I want to open a binary file
: and read the file byte for byte to the end of file, and even save to filebyte for byte in binary can you help me ?
: Thanks I have Delphi5

var
F1,F2 : file of Byte;
B : Byte;
begin
assignfile(F1,'mybinarySourceFile.bin');
assignfile(F2,'mybinaryDestinationFile.bin');
Reset(F1);
Rewrite(F2);
While not eof(F1) do
begin
ReadFile(F1,B);
// do anithing with the readed byte
WriteFile(F2,B);
// and save it in destination file
end;
CloseFile(F1);
CloseFile(F2);
end;


Related Articles and Replies: