comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » retrieving standard error stream from IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
retrieving standard error stream from IDL [message #15683] Mon, 07 June 1999 00:00 Go to next message
Vincent Fournier-Sicr is currently offline  Vincent Fournier-Sicr
Messages: 7
Registered: June 1998
Junior Member
I am trying to interface my IDL code w/ some C-code that ouputs error
messages on the standard error stream ; the C-part of the code crashes
and I would like to retrieve what was sent on the standard error stream.

Could somebody tell me how to do that?
Thanks,
Vincent
Re: retrieving standard error stream from IDL [message #15733 is a reply to message #15683] Thu, 10 June 1999 00:00 Go to previous messageGo to next message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Vincent Fournier-Sicre wrote:
>
> I am trying to interface my IDL code w/ some C-code that ouputs error
> messages on the standard error stream ; the C-part of the code crashes
> and I would like to retrieve what was sent on the standard error stream.
>
> Could somebody tell me how to do that?
> Thanks,
> Vincent

Vincent -

How are you interfacing to C? If you are using SPAWN, then you can
redirect stderr in your command line:

command = 'ls -R1 ' + initdir + ' 2>&1'
SPAWN, ["/bin/sh", "-c", command], results, /NOSHELL, COUNT=count

The output from stderr and stdio will appear in results[].

If you are using CALL_EXTERNAL or LINK_IMAGE then you can use
C system calls to redirect stderr to stdio if that does you any
good. Sorry, offhand I don't remember the function calls.

Doesn't the output from stderr show up on your terminal?

Dave Foster
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: retrieving standard error stream from IDL [message #15810 is a reply to message #15683] Fri, 11 June 1999 00:00 Go to previous message
Vincent Fournier-Sicr is currently offline  Vincent Fournier-Sicr
Messages: 7
Registered: June 1998
Junior Member
> Vincent -
>
> How are you interfacing to C? If you are using SPAWN, then you can
> redirect stderr in your command line:
>
> command = 'ls -R1 ' + initdir + ' 2>&1'
> SPAWN, ["/bin/sh", "-c", command], results, /NOSHELL, COUNT=count
>
> The output from stderr and stdio will appear in results[].
>
> If you are using CALL_EXTERNAL or LINK_IMAGE then you can use
> C system calls to redirect stderr to stdio if that does you any
> good. Sorry, offhand I don't remember the function calls.

>
> Doesn't the output from stderr show up on your terminal?

I am using CALL_EXTERNAL and the standard error does show on the terminal, but
I was getting so many messages on the standard error stream that I had to
store them in a file; I did that in the C-code by doing the following :

fpstderr=open("stderr.tmp",O_RDWR|O_CREAT|O_TRUNC,0755);
close(2);
dup(fpstderr);

Vincent
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Density contour curves
Next Topic: Utilities for converting IDL4 handles to IDL5 pointers

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:31:53 PDT 2025

Total time taken to generate the page: 0.00661 seconds