Thread: Setting File Attributes

  1. #1

    Setting File Attributes

    Anybody know how to set file attributes at runtime? Like if I wanted to create a hidden file, or make a file an archive after I've written to it.

  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    # include <stdlib>
    using std::system;


    system ("attrib +h filename.txt");


    + sets an attribute
    - clears an attribute
    R read-only file attribute.
    A Archive File attribute.
    S system File attribute
    H hidden file attribute
    /S processes all file in all directories in specified path

  3. #3
    hmm I was hoping to find some way to do it without system, but if that's the only way..

  4. #4
    Registered User Xei's Avatar
    Join Date
    May 2002
    I know that there are API calls for it. I have only ever used them to get the attributes and file information so far. Check out

  5. #5
    Registered User
    Join Date
    May 2002
    Hello, everyone.

  6. #6
    I'm Back
    Join Date
    Dec 2001
    there is a chmod() to do that. forgot which header... dos.h/dir.h dont remember.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  4. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  5. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
Website Security Test