reading output (stdout) produced by an archive 
Author Message
 reading output (stdout) produced by an archive

I have a C program that links with an archive that sends its
output to stdout.  Is there a way to capture this output and
use it in my program?

I have thought of reopening stdout using freopen but that
closes stdout.  I need stdout because my final output is
expected to be printed to stdout.  I guess I need to redirect
stdout to stdin or a file and then reset it back to how it
was originally.  Is there a simple way to do that?

Bruce



Sun, 21 Oct 2001 03:00:00 GMT  
 reading output (stdout) produced by an archive
 : I have a C program that links with an archive that sends its
 : output to stdout.  Is there a way to capture this output and
 : use it in my program?

If program foo sends stuff to stdout that you want program bar to use,
rewrite program bar to read input from stdin and execute
$ foo | bar
or similar, depending on your OS.

--
John Rixon



Tue, 23 Oct 2001 03:00:00 GMT  
 reading output (stdout) produced by an archive

Quote:

>I have a C program that links with an archive that sends its
>output to stdout.  Is there a way to capture this output and
>use it in my program?

>I have thought of reopening stdout using freopen but that
>closes stdout.  I need stdout because my final output is
>expected to be printed to stdout.  I guess I need to redirect
>stdout to stdin or a file and then reset it back to how it
>was originally.  Is there a simple way to do that?

As the FAQ explains, no there isn't.

--
-----------------------------------------


-----------------------------------------



Thu, 25 Oct 2001 03:00:00 GMT  
 reading output (stdout) produced by an archive
Quote:

> I have a C program that links with an archive that sends its
> output to stdout.  Is there a way to capture this output and
> use it in my program?

> I have thought of reopening stdout using freopen but that
> closes stdout.  I need stdout because my final output is
> expected to be printed to stdout.  I guess I need to redirect
> stdout to stdin or a file and then reset it back to how it
> was originally.  Is there a simple way to do that?

I don't understand you concern about stdout.  Assuming cprog puts
interesting data on stdout, myprog would be written to accept this data
on stdin.  Then you can redirect cprog's output to a file for later use
by myprog.
% cprog > cp1
% myprog < cp1 > myout

Or maybe a pipe:
% cprog | myprog > myout

--

"Everything should be made as simple as possible, but not simpler."
                    --- Albert Einstein ---



Thu, 25 Oct 2001 03:00:00 GMT  
 reading output (stdout) produced by an archive

Quote:

>> I have a C program that links with an archive that sends its
>> output to stdout.  Is there a way to capture this output and
>> use it in my program?

>> I have thought of reopening stdout using freopen but that
>> closes stdout.  I need stdout because my final output is
>> expected to be printed to stdout.  I guess I need to redirect
>> stdout to stdin or a file and then reset it back to how it
>> was originally.  Is there a simple way to do that?

>I don't understand you concern about stdout.  Assuming cprog puts
>interesting data on stdout, myprog would be written to accept this data
>on stdin.  Then you can redirect cprog's output to a file for later use
>by myprog.
>% cprog > cp1
>% myprog < cp1 > myout

>Or maybe a pipe:
>% cprog | myprog > myout

That would work if they are separate programs but mine isn't.
It is one program that is linked together.

BTW, I'm on a Sun Solaris platform.



Fri, 26 Oct 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. reading output produced by an archive

2. read a file than produce 2 output files(HELP)

3. read a file than produce 2 output files(HELP)

4. building parser and produce SQL output

5. How to produce a % in output?

6. Printing produces very small output

7. Richtext control that produce html output

8. Text output (STDOUT)

9. stdout: why no output?

10. Output to stdout in loop without clrscr

11. stdout and binary output

12. Quick question on services and output to stdout

 

 
Powered by phpBB® Forum Software