Originally Posted by
Daved
Why don't you show us your code snippet to see where you are going wrong. In nadroj's example, you call system like this: system(test.c_str());
Uhm sure.
Its kinda ugly right now, havent really done much to it. Its for a school project thing.
The use of the program is to List users/groups in the computor using system commands and you should be able to change the password/groups of users.
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
system("net users > users.txt");
system("net localgroup > groups.txt");
system("net users");
cout<<"What user would you like to add, to what group?" <<endl;
string user;
getline (cin, user);
system("net localgroup");
cout<<"You would like to add "<< user <<" to what group?" <<endl;
string group;
getline (cin, group);
cout<<user<<" has been added to group "<< group <<endl;
string systemcmd;
systemcmd = "net localgroup ";
systemcmd += group;
systemcmd += " ";
systemcmd += user;
systemcmd += " /add";
cout<<"Executing - "<<endl<<systemcmd<<endl;
system(systemcmd.c_str());
cin>>user[1];
return 0;
}
I got the append thing to work now also, thanks guys.
As you can see, i have alot to do and change to it but its coming along. Thanks for your help.