System call with root level privileges
Hi, I needed my application to change the hardware date & time with a system call to "hwclock". Unfortunately, "hwclock" requires a root / superuser level access. I could make the machine to always log with root though I think it will be a bad practice. I just needed this code to work:
Code:
std::string command="hwclock --set --date=";
std::string dateInput;
/*
Date input from the user.
*/
dateInput="\'..........\'"; //........... == user input
command+=dateInput;
system(command.c_str());
Can anybody help me please?