[comp.lang.pascal] How to determine if I/O redirection is used on the command line?

elmo@troi.cc.rochester.edu (Eric Cabot) (05/20/91)

Hi there netters,
  I'm not sure if this is *really* the correct group, but the
question I have concerns Turbo Pascal (5 or 6) so here goes:

  I want to be able to detect if the user is redirecting standard
input and/or standard output  on the command line. I'd like
to be able to prompt the user for file names if there is no
redirection because in the context of the programs I'm "doctoring"
standard input from the keyboard and output to the screen is
unwanted. However the original progams use standard I/O so many
users still want to be able to pipe the output using redirection.
Others *demand* to be prompted for filenames.

  In the case of output, I have tried to read the command line
using the paramstr function but this doesn't see files
specified as >afile or <afile unless I put the >afile into
the parameter field of the run-menu in the IDE. 

  I suspect there is some nifty way to determine if DOS is
redirecting to/from some file (rather than the default devices)
but I haven't a clue what it is.  
   
  Does anyone have any ideas on this?
--
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Eric Cabot                              |    elmo@uhura.cc.rochester.edu
      "insert your face here"           |    elmo@uordbv.bitnet
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

ts@uwasa.fi (Timo Salmi) (05/21/91)

In article <14165@ur-cc.UUCP> elmo@troi.cc.rochester.edu (Eric Cabot) writes:
:
>  I want to be able to detect if the user is redirecting standard
>input and/or standard output  on the command line. I'd like
:

PC Magazine, April 16, 1991, pp. 373-

...................................................................
Prof. Timo Salmi
Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.12.37
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun