Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How do I redirect stdout from system/execlp calls?

Reply
Thread Tools

How do I redirect stdout from system/execlp calls?

 
 
Paul Nilsson
Guest
Posts: n/a
 
      10-03-2003
Hi,

Does anyone know how to redirect text output when issuing a system or an
execlp call? I have a GUI that insists on opening up a console whenever I
give a system function call, and I would like to redirect the text output to
a char buffer instead.

Paul


 
Reply With Quote
 
 
 
 
WW
Guest
Posts: n/a
 
      10-03-2003
Paul Nilsson wrote:
> Hi,
>
> Does anyone know how to redirect text output when issuing a system


system("a command with output redirected");

> or an execlp call?


There is no execlp in standard C++: http://www.slack.net/~shiva/welcome.txt

> I have a GUI that insists on opening up a console
> whenever I give a system function call, and I would like to redirect
> the text output to a char buffer instead.


It will possibly still open a console. You will need to post your question
to a newsgroup dedicated to your platform/compiler:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

--
WW aka Attila


 
Reply With Quote
 
 
 
 
tom_usenet
Guest
Posts: n/a
 
      10-03-2003
On Fri, 3 Oct 2003 18:38:53 +0200, "Paul Nilsson"
<> wrote:

>Hi,
>
>Does anyone know how to redirect text output when issuing a system or an
>execlp call? I have a GUI that insists on opening up a console whenever I
>give a system function call, and I would like to redirect the text output to
>a char buffer instead.


comp.unix.programmer might be a better place to ask, since standard
C++ has no methods to interact with consoles or any way to launch
processes other than "system".

Tom
 
Reply With Quote
 
Jerry Coffin
Guest
Posts: n/a
 
      10-05-2003
In article <blk8nu$bu$>, says...
> Hi,
>
> Does anyone know how to redirect text output when issuing a system or an
> execlp call? I have a GUI that insists on opening up a console whenever I
> give a system function call, and I would like to redirect the text output to
> a char buffer instead.


Find a newsgroup devoted to the OS you're using, and ask them about
popen -- it's likely to be available, and if it's not, there are at
least likely to be some people who will recognize the name and know what
to advise as an alternative.

--
Later,
Jerry.

The universe is a figment of its own imagination.
 
Reply With Quote
 
Paul Nilsson
Guest
Posts: n/a
 
      10-06-2003
"Jerry Coffin" <> wrote in message
news: ia.net...
> In article <blk8nu$bu$>, says...
> > Hi,
> >
> > Does anyone know how to redirect text output when issuing a system or an
> > execlp call? I have a GUI that insists on opening up a console whenever

I
> > give a system function call, and I would like to redirect the text

output to
> > a char buffer instead.

>
> Find a newsgroup devoted to the OS you're using, and ask them about
> popen -- it's likely to be available, and if it's not, there are at
> least likely to be some people who will recognize the name and know what
> to advise as an alternative.


Hi,

Thanks, aparently this only works for console applications. However, the
MSVC++7 documentation for the popen function links to a document showing how
to do with a windows application as well! So you helped me anyway! Thanks,
Paul

>
> --
> Later,
> Jerry.
>
> The universe is a figment of its own imagination.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
beginner Q: Kernel#puts, STDOUT, $stdout relation Andreas S Ruby 3 12-09-2006 12:39 AM
Problems redirecting STDOUT (NOT sys.stdout) to a pipe. Elad Python 0 03-19-2006 01:30 PM
copy stdout fails with permission denied when stdout is redirected brian.mabry.edwards@gmail.com Perl Misc 2 12-07-2005 10:49 PM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57