I have the following code:
std::string cmd = "sudo chmod a+x file";
int r = system(cmd.c_str());
which works correctly.
How can I do the same thing without calling the system() function?
What I can get to is:
#include <sys/stat.h>
int r = chmod("file", S_IXUSR | S_IXGRP | S_IXOTH);
How can I use "sudo" in this case?
Thank you.