Der Code für „HDSentinel.cpp“ und „Hello World“ ist unten aufgeführt. Es gibt keinen Text zum Anklicken und es gibt auch keine schwarze Umrandung für die Schaltfläche. Durch Klicken auf eine beliebige Stelle im leeren Fenster wird die Schaltfläche ausgewählt:
Zuerst „HDSentinel.cpp“:
Code: Select all
#include
#include
#include
#include
#include
#include
#include
#include
// Function to execute a command with a graphical prompt for privileges
void execute_superuser_command(const std::string& command) {
// Prepend 'pkexec' to the command. Pkexec will handle the graphical password prompt.
std::string full_command = "pkexec " + command;
// Execute the command in the shell
int result = std::system(full_command.c_str());
if (result == 0) {
// Command executed successfully
std::cout
Mobile version