Okay so i'm trying to get this c++ program to run commands on cmd.
Anyway I have got it working though I can't seem to figure out how to use char's in printing to the system. I.e
#include <iostream>
using namespace std;
#define NL '\n'
int main()
{
char lol[50];
cout << "Please enter what you want to enter into cmd";
cout << NL;
cin >> lol;
system("net send" lol)
}
I seem to get an error with adding a second part to the system part.
I can have it by itself I.e
system(lol);
That would work fine but I can't have two for some reason...
Please help!
Thanks
Kingpulse
Now the same thing using C++ strings. Notice you don't need to specify the length of the string. The calls to strcpy and strcat are much simpler - see line 12 below.
@ Aramil of Elixia
this line isn't correct. The destination cannot be written to: strncat(command.c_str(), inputString.c_str(), length);
(it looks like a mutant hybrid of C and C++ code).