[Overview][Procedures and functions][Variables][Index] | Reference for unit 'printer' (#rtl)

# AssignLst

Assign text file to printing device

## Declaration

Source position: printer.pp line 40

`procedure AssignLst(`
`var F: text;`
`ToFile: string`
`);`

## Description

AssignLst assigns to F a printing device - UNIX only. ToFile is a string with the following form:

- '|filename options': This sets up a pipe with the program filename, with the given options, such as in the popen() call.
- 'filename': Prints to file filename. Filename can contain the string 'PID' (No Quotes), which will be replaced by the PID of your program. When closing lst, the file will be sent to lpr and deleted. (lpr should be in PATH)
- {'filename|'}: Same as previous, only the file is not sent to lpr, nor is it deleted. (useful for opening /dev/printer or for later printing)

## See also

lst |  | Default printing file.

## Example

    program testprn;

    uses printer;

    var i : integer;
        f : text;

    begin
      writeln ('Test of printer unit');
      writeln ('Writing to lst...');
      for i:=1 to 80 do writeln (lst,'This is line ',i,'.'#13);
      close (lst);
      writeln ('Done.');
      {$ifdef Unix}
      writeln ('Writing to pipe...');
      assignlst (f,'|/usr/bin/lpr -m');
      rewrite (f);
      for i:=1 to 80 do writeln (f,'This is line ',i,'.'#13);
      close (f);
      writeln ('Done.')
      {$endif}
    end.

Documentation generated on: Feb 26 2014