LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   commands stored into variables? (http://www.linuxquestions.org/questions/programming-9/commands-stored-into-variables-254997/)

benne 11-15-2004 04:23 AM

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

Kess78 11-15-2004 04:27 AM

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...

CroMagnon 11-15-2004 07:20 PM

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


All times are GMT -5. The time now is 08:44 PM.