0
is it possible to use c++ similar to command prompt?
i am not sure whether my question is right or wrong. if right pls tell me the way
6 Answers
+ 3
c++ is a programming language and the command prompt is like a window into your operating system, you can use c++ to send commands through the command prompt however.
+ 1
it is yes
0
thanx bro
0
is it possible to use batch script command in linux
0
AFAIK, system(command) will do that regardless of the OS
0
#include <iostream>
#include <string>
#include <Windows.h> // or <unistd.h> if *nix
using namespace std;
int main()
{
while(1)
{
string R;
getline(cin,R);
system(R.c_str()); //remember system() is unsafe
}
return 0;
}
^
example