[net.lang.c] Redirection

williams@kirk.DEC (John Williams 223-3402) (02/27/86)

For example, VMS has neither redirection nor pipelining. All this
means is that you have to open a file.

#include <stdio.h>

FILE *infile,*outfile;

infile = fopen("file.in","r");
outfile = fopen("file.out","w");
.
.
.
You can now use any stdio function by putting a f in front and
adding the file pointer as the first argument.
.
.
.
fclose(infile);
fclose(outfile);

	Sure, those *features* are missed a little bit, but I certainly
wouldn't call VMS half-assed. I simply takes a little more to get
around that *particular* problem. As a matter of fact, most VMS
tools don't bother with stdio at all, they use default filename
extentions.
						John Williams

jdz@wucec2.UUCP (03/04/86)

In article <1403@decwrl.DEC.COM> williams@dec-kirk.UUCP writes:
>
>For example, VMS has neither redirection nor pipelining. All this
>means is that you have to open a file.

Excuse me? VMS most certainly does have redirection. DCL does not support this
in its syntax as nicely as [bck]sh, but it does indeed do it. Note that the
name for stdin is SYS$INPUT and that stdout is SYS$OUTPUT. The DCL is
$ ASSIGN/USER_MODE "INFILE.DAT" SYS$INPUT
$ ASSIGN/USER_MODE "SAVEOUTPUT.DAT" SYS$OUTPUT
$ RUN PROG

The /USER_MODE option indicates that the redirections are for the execution of
one image only (i.e. just the next program executed).

>#include <stdio.h>
>FILE *infile,*outfile;
>
>infile = fopen("file.in","r");
>outfile = fopen("file.out","w");

But this defeats the entire purpose of i/o independence. Since VMS can do it
right, please do so.

>	Sure, those *features* are missed a little bit, but I certainly
>wouldn't call VMS half-assed. I simply takes a little more to get
>around that *particular* problem. As a matter of fact, most VMS
>tools don't bother with stdio at all, they use default filename
>extentions.

The only problem with VMS and redirection is that DCL doesn't support a nice
syntax for doing this in a command line. If you really want this, buy DECshell
for your system.

Pipes can be made to work using permanent mailboxes and redirecting i/o to
them; this may require some real code in the program, though. At least enough
code somewhere to create the mailboxes in the first place and to do the
appropriate redirection. It just might be able to be done in DCL, but the
ugliness is probably not worth it.
-- 
Jason D. Zions			...!{seismo,cbosgd,ihnp4}!wucs!wucec2!jdz
Box 1045 Washington University
St. Louis MO 63130  USA		(314) 889-6160
Nope, I didn't say nothing. Just random noise.