[comp.sys.ibm.pc] Turbo Pascal vs. the Input standard

nez@bucc2.UUCP (06/04/87)

/* Written  7:43 pm  May 30, 1987 by ncoast.UUCP!allbery in comp.sys.ibm.pc */
> I'm trying to write a program which will read standard input or files named
> on the command line.  (It's a program to expand tabs and formfeeds for my
> DuMbPrinter-105.)  The main block seemed simple enough:
> 
> begin
>   .
>   .      Some code is placed here...
>   .
> end.
> 
>        My Turbo Pascal (3.01A) doesn't seem to recognize Input as a file.
> I leave it undeclared, I get a compile error `unknown identifier or syntax
> error'; if I declare it, I get I/O error 02 (file not reset).

	I tried using the standard file 'Con' and it compiled without
errors (since my program was as useful as your code fragment, I don't
know whether it's free of run-time errors.) 
	You can use the input files 'Con' and 'Kbd' and output files
'Con' and 'Trm' for standard i/o. (Characters input with 'Kbd' aren't
echoed to the screen.)

		Hope this helps...

                           Rich Neswold

         =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                 / bucc2!nez
               ...!ihnp4!bradley!- cyber!xx64194
                                 \ buee730!nez
         =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

allbery@ncoast.UUCP (Brandon Allbery) (06/22/87)

As quoted from <32100007@bucc2> by nez@bucc2.UUCP:
+---------------
| 	I tried using the standard file 'Con' and it compiled without
| errors (since my program was as useful as your code fragment, I don't
| know whether it's free of run-time errors.) 
| 	You can use the input files 'Con' and 'Kbd' and output files
| 'Con' and 'Trm' for standard i/o. (Characters input with 'Kbd' aren't
| echoed to the screen.)
+---------------

No, you can't; I was trying to accept "pr < file" or "pr file"; using Con or
Trm doesn't get redirected input from a file.

As it turned out, I had to include a "program pr(Input, Output);" at the
beginning to get it to work; I usually leave this off because I consider
the standard Pascal way of declaring files to be a major lossage.  (Then
again, it seems to have been devised for card-fed systems where you have
to associate logical files with physical files at the JCL level.)

++Brandon
-- 
Copyright (C) 1987 Brandon S. Allbery.  Redistribution permitted only if the
		redistributor permits further redistribution.
     ---- Moderator for comp.sources.misc and comp.binaries.ibm.pc ----
Brandon S. Allbery	{decvax,cbosgd}!cwruecmp!ncoast!allbery
aXcess Company		{ames,mit-eddie,talcott}!necntc!ncoast!allbery
6615 Center St. #A1-105	necntc!ncoast!allbery@harvard.HARVARD.EDU
Mentor, OH 44060-4101	+01 216 974 9210	(also eddie.MIT.EDU)