retrieving standard error stream from IDL [message #15683] |
Mon, 07 June 1999 00:00  |
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   |
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  |
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
|
|
|