its called System("command in here");
Hey all id like to start off by introducing myself, Im bombsaway707 i code Visual Basics fairly well and id like to start learning C++. Ok now i was just wondering how to shell things in C++. For example in VB shelling a tapper would be:
Is there a way to shell commands like this in C++?Code:Shell("ipconfig/ release")
+ rep for answer
its called System("command in here");
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
System(" * ");
The command goes where the asterisks is
An alternative from using System().
[php]
ShellExecute( NULL, "open", "C:\\WINDOWS\\system32\\cmd.exe","/C ipconfig/release",NULL, SW_SHOWNORMAL);
[/php]
Zoom (01-23-2010)
And david beat me to the alternative
Ah we-a blaze the fyah, make it bun dem!
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
Another alternative is to use CreateProcess().
But I suppose it's easier to go with system/shellexecute if you are a beginner.