cs457ab@unm-la.UUCP (David W. Barts) (10/21/86)
If you have tried it, you know that it doesn't work. Coming
from a UNIX environment, where redirection works for programs
written in any language, I find this very disturbing. My question
is, is there an easy way to write Turbo programs that send
output to standard output so that <, >, and | work?
I have tried using the intr($21, ) call for this. It works,
but then there's the problem of echoing standard input. You
can either ALWAYS echo stdin (AH = 01, not what I want if stdin is
a file), or NEVER do it (AH = 08, unacceptable if stdin is CON:)
What I am looking for is either
a. A way to tell if stdin is CON:, so I can then
echo or not echo as is appropriate, or
b. A way to do this WITHOUT having to resort to
issuing DOS interrupts in my Pascal code.
Please respond directly to me and not to the net as I am
years behind in reading net articles and probably won't get
caught up any time soon. In a few weeks I will summarize to
the net.
--
--David Barts N5JRN
... {cmcl2,ihnp4}!lanl!unm-la!cs457ab
... {ucbvax,gatech}!unmvax!unm-la!cs457ab
unm-la!cs457ab@lanl.arpa
University of New Mexico - Los Alamosmarms@sandia.UUCP (10/22/86)
I ran into this "problem" myself some months ago. I wanted to pipe
the output of my Turbo Pascal program to a file (ie: "work.com > file").
After beating my head against a wall trying all kinds of things, I found
the simple answer in the book. There is a compiler directive to set the
I/O mode such that stdin and stdout can be redirected. I don't have the
book with me but it is probably either {$I-} or {$I+}. It could be one of
the other compiler directives, though. Check that chapter to know for sure.
Hope this has been some help.
Mike Arms
uucp: ...{ucbvax | ihnp4!lanl | gatech}!unmvax!sandia!marmssmvorkoetter@watmum.UUCP (Stefan M. Vorkoetter) (10/23/86)
Turbo Pascal does support I/O redirection. Simply make the first line of
the main program source file read,
{$G512,P512}
so that Turbo Pascal uses MS-DOS buffered output. I/O redirection works
fine then (except in compile to memory mode).klotz@ihuxy.UUCP (Dave Klotzbach) (10/23/86)
> If you have tried it, you know that it doesn't work. Coming Could you possibly tell us which version of TP you ar using? If you are using a version less than 3. this is true, otherwise you simply have to set the buffers size for inp and out to greater than 1. See the common question section of your manual. This is covered in great detail. > Please respond directly to me and not to the net as I am > years behind in reading Due to the negative press TP has been getting lately I felt that this it is important to negate these complaints as publicly as they are aired.
tla@kaiser.UUCP (T Anderson) (10/24/86)
Starting with Turbo 3.0 there is a compiler directive that makes Turbo
use MS DOS I/O and then redirection works fine. I don't have my manual
with me so I do not remember the exact stuff, but its something like
(*$P512 $G256*) where the numbers are the sizes of the buffers you
want to use. $P is for output (put or something) and $G for input
(get). It does make all I/O somewhat slower as the overhead for an
MS DOS call is more than Turbo's direct I/O.
-- Terry L Anderson
AT&T Bell Laboratories
Liberty Corner, NJ
{ihnp4}!daimler!kaiser!tladea@hpcesea.HP (Bob Dea) (10/24/86)
Turbo Pascal version 3.0 has support for I/O re-direction by way of
Compiler Directives {$Gxxx} for input and {$Pxxx} for output. I
have used this only in redirecting output to a file. Hope this helps!sbanner1@uvicctr.UUCP (S. John Banner) (10/30/86)
In article <197@sandia.UUCP> marms@sandia.UUCP (Mike Arms) writes: >I ran into this "problem" myself some months ago. I wanted to pipe >the output of my Turbo Pascal program to a file (ie: "work.com > file"). >After beating my head against a wall trying all kinds of things, I found Same Here. >the simple answer in the book. There is a compiler directive to set the >I/O mode such that stdin and stdout can be redirected. I don't have the >book with me but it is probably either {$I-} or {$I+}. Actually, you have to use the G, and P directives, to set file buffer sizes, and if you want to send the output (or get the input), from a device rather than a file ("uudecode < com1:", or whatever), you also have to set another directive (B I think), otherwise it will reset your buffers to 0 again. The I directive is strictly used to determine what to do on an input error. S. John Banner UUCP: ...!uw-beaver!uvicctr!sbanner1 BITNET: ccsjb@uvvm EAN: sbanner1@uvunix.uvic.cdn