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: paul_h@jenson.com (Paul) Subject: Re: Problem with C function 'system()'... Date: 1995/12/04 Message-ID: <1995Dec4.103937.64@jenson.demon.co.uk>#1/1 X-Deja-AN: 120925012 distribution: world x-nntp-posting-host: jenson.demon.co.uk references: , <49lphs$5q3@gap.cco.caltech.edu> organization: Jenson Technology Group Ltd. newsgroups: comp.os.vms,comp.sys.vms In article <49lphs$5q3@gap.cco.caltech.edu>, carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) writes: > = fclose (stdout); > = stdout = fopen (redir_file, "w"); > > Just out of curiosity, why use fclose() and fopen() when you've got freopen(), > which is there to do exactly what it you're attempting with fclose() and > fopen()? Of course freopen is shorter, I've just never used it in anger. Nothing wrong with curiosity: In the dim and distance past, when I was learning Vax C, I remembered doing an experiment, "what if I close stdout", when that worked I tried adding a "printf" statement to see what happened writing to a closed channel, finding that also didn't crash I tried opening a new file on stdout. My (unsurprising) conclusion was that there was nothing "special" about stdout! So my response to the post was based on the memory of something like: fclose (stdout); printf ("hello"); stdout = fopen ("test", "w"); printf ("again); Paul Harris * Senior Technical Consultant * Jenson Technology Group * Bristol personal email to ehteam@telecall.co.uk web home page http://www.telecall.co.uk/pharris/ fidonet 2:250/110.2 or 2:2500/502.17 keywords: alpha vax vms c amiga clueless waster