Welcome to the most active Linux Forum on the web.
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, 05: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, 05: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 05:29 AM.
Old 11-15-2004, 08: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 09:54 PM
where are the environment variables stored? ojav Linux - Newbie 3 05-31-2005 05:00 PM
where does static and global variables stored raviksp General 0 04-28-2005 01:23 AM
Where are variables permaninently stored? tearinox Linux - General 4 06-05-2004 11:42 AM
Where are the environmental variables (eg. $DISPLAY) stored? davidas Linux - Newbie 2 04-08-2004 02:33 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:24 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