Usenet comp.sys.vms (1990-2004)
 help / color / mirror / Atom feed
From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
Subject: Re: Problem with C function 'system()'...
Date: 1995/11/29	[thread overview]
Message-ID: <49iddt$54c@gap.cco.caltech.edu> (raw)
In-Reply-To: 49hq59$lh4@nntpd2.cxo.dec.com

In article <49hq59$lh4@nntpd2.cxo.dec.com>, Brian Hibbert <b_hibbert@csc32.enet.dec.com> writes:
=I suspect the command is "working", the problem is it isn't doing what 
=you want.  The system() function spawns a subprocess, waits for it to 
=complete, and returns the status from the call.  What you are doing is
=changing SYS$OUTPUT for a temporary subprocess, I suspect you are trying 
=to redirect the output of stdout.  

Your analysis of what happens is correct.

=I don't know how to do this within C on a VAX (I have never tried it).

You could use freopen(), or, before you do any I/O to stdout, you could
redefine SYS$OUTPUT, either via the SYS$CRELNM system service (which, for an
unprivileged user, will make a user-mode definition), or via
LIB$SET_LOGICAL (which will create a supervisor-mode definition).
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.



  reply	other threads:[~1995-11-29  5:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-11-27  5:00 Problem with C function 'system()' Carl J. Lambrecht
1995-11-29  5:00 ` Brian Hibbert
1995-11-29  5:00   ` Carl J Lydick [this message]
1995-11-29  5:00 ` Paul
1995-12-01  5:00   ` Carl J Lydick
1995-12-04  5:00     ` Paul
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox