Hello!!!
I want to execute a command from c++ as if it was executed from the
command prompt...
how can I do that?
thanks!!
:wave:
Printable View
Hello!!!
I want to execute a command from c++ as if it was executed from the
command prompt...
how can I do that?
thanks!!
:wave:
try something like this
orCode:system("start notepad");
Code:system("notepad");
is that for visual c++ .Net or for native c++?
:wave:
I tired this in VC6.0...from next time do mention your requirements completely
do I need to include any class to use this command?
because my sytem doesn't recognise it...
:wave:
For C++, include <cstdlib> and use std::system().
For C, include <stdlib.h> and use system().
Just curious what does the system function do generally?
It passes the string you give it to "the system shell" (whatever that is) for execution.
In Linux, this usually means the Bourne Shell, /bin/sh. In Windows, it means cmd.exe.
ok,I understood that partially,does it mean that it executes whatever file or string I put in it?Quote:
Originally Posted by CornedBee
No. "It passes it to the shell" means exactly that.
If you want to know what it does, select Start->Run, type "cmd", and in the window that opens, type whatever you want to pass to system().
You can always refer to MSDN
http://msdn.microsoft.com/library/de..._._wsystem.asp