help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'System' (#rtl)

Assign

Assign a name to a file

Declaration

Source position: line 0

procedure Assign(

  var f: file;

  const Name: String

);

procedure Assign(

  var f: file;

  p: PChar

);

procedure Assign(

  var f: file;

  c: Char

);

procedure Assign(

  var f: TypedFile;

  const Name: String

);

procedure Assign(

  var f: TypedFile;

  p: PChar

);

procedure Assign(

  var f: TypedFile;

  c: Char

);

procedure Assign(

  var t: Text;

  const s: String

);

procedure Assign(

  var t: Text;

  p: PChar

);

procedure Assign(

  var t: Text;

  c: Char

);

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.

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.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505