Solved

How to get result from system command execution

Posted on 2002-04-18
2
184 Views
Last Modified: 2010-04-21
What is the function like system() that return the result of execution instead of printing the result on the terminal.

ex:

result = system("/usr/local/md5 1234");

I want to get the result of the md5 command, not a return status.

Thank you for you help
0
Comment
Question by:mrbird
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
MFCRich earned 20 total points
ID: 6953439
FILE *popen(const char *command, const char *type)

See man popen

'type' is determines if the FILE is open for reading or writing just like the fopen function.

> FILE *fp = popen("/usr/local/md5 1234", "r");
> # Now read from fp

0
 

Author Comment

by:mrbird
ID: 6954202
Thank you
It works now.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question