Solved

How to get result from system command execution

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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

627 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