The close procedure

Description

The close procedure closes a file variable, and the file or pipe associated with it. Before the file variable is closed, it is flushed as if the built-in procedure flush was called. NOTE: The file variable must be open when this procedure is called.

Parameter

The close procedure's only parameter is a reference to the file variable to close.

Example

   function CountLines(name : filename) : integer;
   var
      count : integer;
      f : text;
   begin
      count := 0;
      reset(f, name);
      while not eof(f) do
         begin
            readln(f);
            inc(count);
         end;
      CountLines := count;
      close(f)
   end;

Portability

Operating Systems: All
Standard Pascal: No