From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,a83f48e38df3b490 X-Google-Attributes: gidf7344,public X-Google-Thread: fc7fa,a83f48e38df3b490 X-Google-Attributes: gidfc7fa,public From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) Subject: Re: Problem with C function 'system()'... Date: 1995/11/29 Message-ID: <49iddt$54c@gap.cco.caltech.edu>#1/1 X-Deja-AN: 120492909 distribution: world references: ,<49hq59$lh4@nntpd2.cxo.dec.com> organization: HST Wide Field/Planetary Camera reply-to: carl@SOL1.GPS.CALTECH.EDU newsgroups: comp.sys.vms,comp.os.vms In article <49hq59$lh4@nntpd2.cxo.dec.com>, Brian Hibbert 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.