home *** CD-ROM | disk | FTP | other *** search
- PROGRAM DeviceAssignmentDemo;
- {
- This program demonstrates the redirection of output to different
- devices, under program control.
-
- Source: "Selecting Output Devices From A Program", TUG Lines Volume I Issue 5
- Author: Dwight William Johnson
- Application: All systems
- }
-
- var
- FileVar: text;
- InKey: char;
- Input: string[40];
- begin
- ClrScr;
- write(' (S)creen or (P)rinter output? ');
- repeat
- read(kbd,InKey);
- InKey:=Upcase(InKey);
- until InKey in ['S','P'];
- writeln;
- if InKey='S' then
- assign(FileVar,'con:')
- else
- assign(FileVar,'lst:');
- reset(FileVar);
- readln(Input);
- writeln(FileVar,Input);
- end.