Solved

How to get result from system command execution

Posted on 2002-04-18
2
183 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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