Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-12-2002, 06:48 AM   #1
LQ Newbie
Registered: May 2002
Posts: 2

Rep: Reputation: 0
c/c++ running a shell script?

I am trying to write a small c/c++ program as a wrapper for a bash script. I need the wrapper to take some input args, call the bash script with the supplied args and then return the output of the bash script.

As far as I can see system() will call the script ok, but it will only return an int , not the actual output of the script, unless I've got that wrong.

Can anyone help me out here?

Old 05-12-2002, 07:46 AM   #2
Registered: Apr 2002
Location: Brazil
Distribution: Slackware
Posts: 184

Rep: Reputation: 30
man fork
man pipe
man wait


Old 05-12-2002, 11:25 AM   #3
LQ Newbie
Registered: Apr 2002
Location: USA
Distribution: RedHat/Suse/Mandrake
Posts: 18

Rep: Reputation: 0
Easy way will be write output to file from bash and then read that file from c++ program.
Old 05-12-2002, 11:41 AM   #4
LQ Newbie
Registered: May 2002
Posts: 2

Original Poster
Rep: Reputation: 0
Yeah, its looking that way at this point. unfortunately my knowledge of c doesn't stretch to forking and piping and I am under time pressure right now.

thanks for the suggestions.



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
Running shell script within a C or C++ program Quantum0726 Programming 2 06-15-2005 09:14 PM
running a program from shell script Suinatsa Programming 10 04-14-2005 11:25 AM
running SHell script from java anirudh Programming 2 01-07-2005 07:37 AM
Running shell script install, how? henrikanttonen Linux - Newbie 9 08-06-2004 08:46 PM
Running script as user that does not have shell sschueller Linux - General 1 04-24-2004 03:06 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:19 AM.

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