_tmkdir

Can any one tell me if write permissions to the particular directory are sufficient for _tmkdir to create a new sub directory or are any higher permissions required.

Thanks,

KarthikR




Answer this question

_tmkdir

  • mars76

    rKarthik wrote:
    Can any one tell me if write permissions to the particular directory are sufficient for _tmkdir to create a new sub directory or are any higher permissions required.

    In Win32, _tmkdir is just a wrapper for CreateDirectory. The only permissions needed to create a directory is the Create directory right (FILE_ADD_SUBDIRECTORY), although if you want to be able to use it, you'll probably need more rights than this.

    Note that _tmkdir cannot be used to create intermediate directories (just like the md command when command prompt extensions are disabled). You're not allowed to create C:\Dir1\Dir2 if C:\Dir1 doesn't exist. If you want to create intermediate directories, use SHCreateDirectory instead, or if you're allowed to use managed code, System::IO::Directory::Create().



  • Robbiex

    Hello KarthikR,

    The access rights for a directory are assigned by the administrator of the computer and generally should not be reassigned by a program. You'll note that C++ does not provide a way to alter or even read these access control lists.

    In order to find out what access rights you have for the folder, open up the folder's properties (in Windows Explorer) and choose the security tab, then Advanced. In this UI, the FILE_ADD_SUBDIRECTORY right is called "Create Folders/Append Data". If you double click your user name (or group), you can see if you have this right.

    If this is the only right you have to the folder, then the only activity you can perform in this folder is create folders. NO writing to the folder is allowed, NO checking to see if the folder was created, NO reading from the new folder, NO resetting of the permissions, NO detection of whether the folder even exists is allowed. All of these actions will require more rights.

    The only thing you can do with the new folder is create more directories (may or may not fail, but you won't know since you're not allowed to check).



  • jam281

    Hi Oshah,

    Can you tell me how do I correlate FILE_ADD_SUBDIRECTORY and the general windows read/write permissions for a directory. Also, you mentioned that I would probably need more rights to be able to use it. Can you explain.

    Thanks a lot,

    KarthikR



  • _tmkdir