I tried to research this for a bit and I can't figure out the problem
Here's the code:
#include <iostream> #include <stdlib.h> #include <string> void choose(); void newuser(); void admuse(); using namespace std; string x; string z; string w; void CreNeAcc(){ cout << "Enter User Name for your new account\n"; getline(cin, x); cout << "Enter Password for your new account\n"; getline(cin, z); cout << "Would you like the account to be admin?\n"; cout << "Yes = Y, No = N\n"; getline(cin, w); choose(); } void choose(){ if(w == "Y"){ newuser(); admuse(); }else if(w == "N"){ newuser(); }else{ cout << "Invalide Command\n"; } } void newuser(){ const char* Letter_x = x.c_str(); char command [100] = "net user /add "; strcat(command, x); //This is where I get the error strcat(command, " "); strcat(commad, z); system(command); } void admuse(){ system("new localgroup administrators " << x << " /add") } also the error its giving me is:
cannot convert 'std::string {aka std::basic_string<char>}' to 'const char*' for argument '2' to 'char* strcat(char*, const char*)'|