Created
July 20, 2018 10:12
-
-
Save azk-mochi/ac3af2035cfbc63adca1e0daaea87135 to your computer and use it in GitHub Desktop.
Check whether root or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <unistd.h> | |
using namespace std; | |
int main(void){ | |
if(getuid() == 0){ | |
cout << "You are root." << endl; | |
}else | |
cout << "You are not root." << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment