Last active
December 14, 2015 00:19
-
-
Save afazio/4998363 to your computer and use it in GitHub Desktop.
Compile:
"gcc -o main main.c" Call:
"./main /path/to/some/file/or/directory"
This file contains hidden or 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 <stdio.h> | |
#include <unistd.h> | |
int main (int argc, char** argv) { | |
char* path = argv[1]; | |
printf ("Checking write permissions for %s:\n", path); | |
int result = access(path, W_OK); | |
printf ("User %s have write permissions.\n", (result == -1 ? "does NOT" : "DOES")); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment