I am trying to use the Net User command from the cmd in my C++ program. I have this...
char acUserName[100];
DWORD nUserName = sizeof(acUserName);
if (GetUserName(acUserName, &nUserName)){
cout << "User Name: " << acUserName << endl;
system("Net User");
}
This displays the User Name on the screen and then also calls the Net User function, This part works fine. What I'm having problems with is I want to use the Net User username function with the acUserName the program already gets.
The only way I can think of doing that is....
char acUserName[100];
DWORD nUserName = sizeof(acUserName);
if (GetUserName(acUserName, &nUserName)){
cout << "User Name: " << acUserName << endl;
system("Net User " && acUserName);
}
But I get the following error "cannot convert `bool' to `const char*' for argument `1' to `int system(const char*)' "
I can't figure out how to make this work. Can anyone help me out with this please?