LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 11-15-2004, 04:23 AM   #1
benne
Member
 
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..

cheers,
Benne
 
Old 11-15-2004, 04:27 AM   #2
Kess78
Member
 
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...

Try: http://www.iota-six.co.uk/c/i1_file_...and_output.asp

Bye Kess...

Last edited by Kess78; 11-15-2004 at 04:29 AM.
 
Old 11-15-2004, 07:20 PM   #3
CroMagnon
Member
 
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.
 
  


Reply


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 04:55 AM.

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