LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

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


Hi,
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?

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

Rep: Reputation: 30
man fork
man pipe
man wait

HTH,

vfs.
 
Old 05-12-2002, 11:25 AM   #3
rcgroups1
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
thermalpants
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.

 
  


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:51 PM.

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