Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-15-2004, 04:23 AM   #1
Registered: Sep 2004
Location: Iceland
Distribution: Gentoo
Posts: 44

Rep: Reputation: 15
commands stored into variables?

Hoi there!

How do I let my program (c++) exucte a unix command (e.g. cat /proc/cpuinfo | grep "model name")? I need to collect some information about the computer it is running on, and play around with it..

I can imangine this will be very simple, as it seems to be..

Old 11-15-2004, 04:27 AM   #2
Registered: Jul 2004
Location: Switzerland
Distribution: Debi@n, SuSE
Posts: 36

Rep: Reputation: 15
C, C++, Java, etc... can work on files...
I dont remember the C++ function that open files but it's something like fopen().
You dont need to execute a command, work directly on the file...


Bye Kess...

Last edited by Kess78; 11-15-2004 at 04:29 AM.
Old 11-15-2004, 07:20 PM   #3
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
The C function is system() - you should be able to call it from C++ also.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where are environment variables stored? binarybob0001 Linux - General 8 11-15-2005 08:54 PM
where are the environment variables stored? ojav Linux - Newbie 3 05-31-2005 04:00 PM
where does static and global variables stored raviksp General 0 04-28-2005 12:23 AM
Where are variables permaninently stored? tearinox Linux - General 4 06-05-2004 10:42 AM
Where are the environmental variables (eg. $DISPLAY) stored? davidas Linux - Newbie 2 04-08-2004 01:33 AM

All times are GMT -5. The time now is 10:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration