Unit 'System' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

Assign

Assign a name to a file.

Declaration

Source position: systemh.inc line 1382

procedure Assign(

  out f: file;

  const Name: ShortString

);

procedure Assign(

  out f: file;

  const p: PAnsiChar

);

procedure Assign(

  out f: file;

  const c: AnsiChar

);

procedure Assign(

  out f: file;

  const Name: UnicodeString

);

procedure Assign(

  out f: file;

  const Name: RawByteString

);

procedure Assign(

  out f: TypedFile;

  const Name: shortstring

);

procedure Assign(

  out f: TypedFile;

  const p: PAnsiChar

);

procedure Assign(

  out f: TypedFile;

  const c: AnsiChar

);

procedure Assign(

  out f: TypedFile;

  const Name: unicodestring

);

procedure Assign(

  out f: TypedFile;

  const Name: RawByteString

);

procedure Assign(

  out t: Text;

  const s: shortstring

);

procedure Assign(

  out t: Text;

  const p: PAnsiChar

);

procedure Assign(

  out t: Text;

  const c: AnsiChar

);

procedure Assign(

  out t: Text;

  const s: unicodestring

);

procedure Assign(

  out t: Text;

  const s: RawByteString

);

Description

Assign assigns a name to F, which can be any file type. This call doesn't open the file, it just assigns a name to a file variable, and marks the file as closed.

Note that the filename (including path) can be only 255 characters long.

Errors

None.

See also

Reset

  

Open file for reading.

Rewrite

  

Open file for writing.

Append

  

Open a file in append mode.

Example

Program Example5;

{ Program to demonstrate the Assign function. }

Var F : text;

begin
  Assign (F,'');
  Rewrite (f);
  { The following can be put in any file by redirecting it
    from the command line.}
  Writeln (f,'This goes to standard output !');
  Close (f);
  Assign (F,'Test.txt');
  rewrite (f);
  writeln (f,'This doesn''t go to standard output !');
  close (f);
end.

Documentation generated on: Oct 02 2024