Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-12

What is code to open any file?

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to A. Erdogan Horzum
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.

Reply by email