ok I'm running redhat 7.3 and using kdevelop 2.1
I'm trying to make a c++ program that i can execute when a user "newuser" logs in.
the program needs to some how execute the "adduser" and "passwd" commands and input the username and password the user of the program enters
where i'm stuck is somehow opening the "adduser" program and inputing the user name, wondering if this would work, "
string username = "";
string password = "";
//get username
outFile.open( "/usr/sbin/adduser.exe", ios::app )
cout << "please enter desired username";
cin >> username
outFile << username << endl;
outFile.close();
//get pass
outFile.open("/usr/bin/passwd.exe", ios::app)
cout << "please enter desired password";
cin >> password;
outFile << username << password << endl;
outFile.close()
cout << "thanks for using our services";
return 0;
}
as you can probably tell i'm no c++ genus, but would this work or is there some other way i should do this? please help