LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-18-2010, 06:46 AM   #1
er.saurabh
LQ Newbie
 
Registered: Dec 2009
Posts: 13

Rep: Reputation: 0
Lightbulb How to call other executables from cpp code


Dear experts,

I want to launch other executable from my cpp code.

I am aware that system() call may do this ,

But, problem is that , I want my cpp code to capture the standard
out ,what "called" program is writing to stdout.


Have anybody have any idea...

Thanks..

Last edited by er.saurabh; 01-18-2010 at 07:15 AM.
 
Old 01-18-2010, 07:21 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
The popen function will do this for you. Use the "r" type to capture the standard output.

Note that if you want to control both the standard input and the standard output of the other executable, you will need to make use of fork and exec, and redirect the io streams.
 
1 members found this post helpful.
Old 01-18-2010, 08:23 AM   #3
er.saurabh
LQ Newbie
 
Registered: Dec 2009
Posts: 13

Original Poster
Rep: Reputation: 0
thanks got...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
call the C executable inside the C is noname Programming 9 01-09-2010 09:28 AM
[SOLVED] How to call cpp library function in c code? eryn Programming 19 12-07-2009 01:41 AM
How to call system call from usb driver's code Mr.J Linux - Kernel 4 09-29-2008 03:47 AM
problem of function call address in executable file valpa Programming 12 09-05-2008 08:36 AM
AIX System Call in Cpp varunharidas AIX 2 08-03-2006 07:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration