[fpc-pascal]What is code to open any file?

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Jan 2 12:00:34 CET 2002


On Mon, 31 Dec 2001, A. Erdogan Horzum wrote:

>
> Hi everybody,
>
> What is code to open any file (filename.exe,  filename.txt, filename.htm...)?

See the manuals: Assign() and Reset/Rewrite.

Var
  f : Text;

{or
  F : File;
  for untyped file or
  F : File of byte;
for byte access }

begin
  Assign(F,'somefile.txt');
  Reset(f); { Open for reading; Open for writing is done with Rewrite(f) }

  { do things }
  close(f);
end.

Michael.





More information about the fpc-pascal mailing list