Solved

How to get result from system command execution

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now