Hello, I need to create some dirs (one for each user), taking the dir name from a given string.
I managed to do this with the following code:

DIR *dir_ptr;
char *target_dir;

target_dir = malloc(32*sizeof(char));

for(all users)  {

    /* Set username for current user */
    target_dir[0] = '\0';
    strcat(target_dir, "./Environment");
    strcat(target_dir, "/");
    strcat(target_dir, username);
    strcat(target_dir, "/");

    /* check for DIR existence, if not, create */
    if((dir_ptr = opendir(target_dir)) == NULL)  

My problem is these dirs are created with no permissions at all, I've got to set them manually doing "chmod 777 name", is there a function out there to create dirs with permissions already setted? I need to use them later from inside my application and I want the users to be able to modify them from the OS (ie adding files inside).
I use Debian, in XP no problems!

9 Years
Discussion Span
Last Post by Salem
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.