read only folder on Windows

This is a discussion on read only folder on Windows within the Windows Programming forums, part of the Platform Specific Boards category; Hello everyone, In my application I need to create a folder and make it read only to test whether my ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    read only folder on Windows

    Hello everyone,


    In my application I need to create a folder and make it read only to test whether my application could work with read only media.

    I have tried to set the property of a folder to read only (right click the mouse and make Read Only property enabled), but I find I still can create file into this folder.

    How to make a folder truly read only on Windows (e.g. can not create file into the folder)?

    Both programming ways and non-programming ways are appreciated. I am using Windows XP SP2.


    thanks in advance,
    George

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If you actually want to test if your application will work from a CD-ROM, I would recommend that you burn a CD of it, rather than trying to artifcially simulate that scenario.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    You can't create a "read-only" folder the way you want. What you need is file permissions. This requires a NTFS file system.
    If you have XP Professional, you can use the Security tab to set security options (namely, deny file creation in that folder). If you have XP Home, you may have to try a 3rd party utility (such as Security Manager).
    Google is your friend on setting security permissions on folders.

    Btw, making the folder read-only will only make it impossible to overwrite (replace the dir with another).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. confused with read()
    By _EAX in forum Linux Programming
    Replies: 2
    Last Post: 03-17-2008, 05:14 PM
  2. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  3. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 10:37 AM
  4. Folder Password Programs (Windows)?
    By johnc in forum C Programming
    Replies: 8
    Last Post: 07-18-2002, 07:39 AM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM

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