Windows File open permisisons

This is a discussion on Windows File open permisisons within the C Programming forums, part of the General Programming Boards category; I am working on porting a some software form Unix to windows. I create a couple files and want their ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    41

    Windows File open permisisons

    I am working on porting a some software form Unix to windows. I create a couple files and want their permissions to be set to 777(or the windows equivilent) they are currently being set with the unix variables:

    Code:
    i_fileID = open( 
         pc_FileName,
         O_WRONLY|O_CREAT, S_IRUSR|S_IROTH|
         S_IRGRP|S_IWUSR|S_IWOTH|S_IWGRP|S_IXUSR|S_IXOTH|S_IXGRP);
    these of course are not defined in any windows headers. i havnt found a good way of changing them so that this opens a file with full permissions.
    Last edited by somekid413; 10-18-2010 at 12:36 PM.

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,236
    Complete control over this is only possible with the CreateFile API. Note that Windows doesn't have a concept of an "executable" bit, nor does it have UNIX-style groups. The access permissions are granted via ACLs.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    41
    The interesting part is in Microsoft's subsystem for Unix applications (SUA) in their include headers they define those variables in a similar fashion to the Unix counterpart. since they are just constants couldn't I copy them over into a header that my code could use?

    also. How different is open() and fopen()? this code I'm working on is fairly old... I already had to replace some memalign() calls.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 09:00 AM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  4. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21