{***********************************************************************}
{									}
{ __StdIOFil  Open a text file as a standard device			}
{									}
{ procedure __StdIOFil(var TextFile : text;				}
{			  StdDevice : word;				}
{		      var ErrorCode : word);				}
{									}
{	      TextFile	The text file to be opened as a standard DOS	}
{			device. 					}
{	      StdDevice The handle of the standard DOS device.	The	}
{			file is opened as the corresponding DOS device. }
{	      ErrorCode The returned status code.			}
{			(0) File successfully opened as the device	}
{			(6) Invalid handle number.  The only acceptable }
{			    values for StdDevice are 0 through 4.	}
{									}
{ Description This procedure allows you to associate any of the 	}
{	      standard DOS devices with a Turbo Pascal text file.	}
{	      Recall that if you use the Turbo Pascal CRT unit, Input	}
{	      and Output are not associated with standard input and	}
{	      output (the screen is accessed directly, for example).	}
{	      With __StdIOFil you can associate these devices with	}
{	      another file.						}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

procedure __StdIOFil(var TextFile : text;
			StdDevice : word;
		    var ErrorCode : word);

  begin {__StdIOFil}

    if (StdDevice > 4) then
       ErrorCode := 6
    else
       begin
	 Assign (TextFile,'');
	 if (StdDevice = _STDIN) then
	    Reset(TextFile)			{ Open for input	}
	 else
	    Rewrite(TextFile);			{ Open for writing	}
	 TextRec(TextFile).Handle := StdDevice;
	 ErrorCode := 0;
       end

  end;	{__StdIOFil}
