Results 1 to 3 of 3
Hello
How to take output of following command/ or any linux shell script in c/c++ program
This command return the system memory/ram size.
char *szCommand="grep MemTotal /proc/meminfo";
system(szCommand);
Is there ...
- 06-26-2008 #1Just Joined!
- Join Date
- Jun 2008
- Posts
- 15
How to take output of linux shell command in C/C++ program
Hello
How to take output of following command/ or any linux shell script in c/c++ program
This command return the system memory/ram size.
char *szCommand="grep MemTotal /proc/meminfo";
system(szCommand);
Is there any alternative of doing this?
Thanks
Ritesh
- 06-26-2008 #2
If I understand your question correctly, you wish to examine with your program the output of an executed program or script or shell command line.
Do this at the command line:
If man pages are not installed on your system, google this:Code:man popen
Hope this helps.Code:linux man popen
--
Bill
Old age and treachery will overcome youth and skill.
- 06-26-2008 #3Just Joined!
- Join Date
- Jun 2008
- Posts
- 15
Yes it solves my problem.
Thanks for quick reply.


Reply With Quote