I'm taking in an ouput folder name as an argument with argv[] and then executing the following code:
mkdir(outputname, "0777");
And sometimes it will work fine and create the folder with the correct permissions but occasionally the folder will get created and I won't be able to access the folder. Is this a common problem problem with a simple fix?
You're sending a string to mkdir
for the mode, and this is the wrong type. If you include the correct headers the compiler should warn you about this. The fix is simple enough,
#include <sys/stat.h>
#include <sys/types.h>
...
mkdir(outputname, 0777);