Thread: change file information

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    19

    change file information

    Hello,

    Using stat() you can retreive information about a file, is there a similar function to or way to set the values? If you modify a value in the stat structure that you populate, can you write it back to the file?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well there are specific API calls like chmod / chown to update specific things, but there isn't a single API to allow you to change things arbitrarily.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    if you want to modify the access/modify times, you can try the utime() function.

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    19
    Thanks Ill take a look at utime()!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Information from a file and structs?
    By equitrainer86 in forum C Programming
    Replies: 0
    Last Post: 03-02-2010, 07:42 PM
  2. how to get information about a file
    By luca in forum C++ Programming
    Replies: 5
    Last Post: 05-15-2007, 09:37 AM
  3. File Information
    By Scarvenger in forum Windows Programming
    Replies: 3
    Last Post: 08-26-2006, 05:02 PM
  4. MP3 File Information
    By Marc in forum C++ Programming
    Replies: 2
    Last Post: 11-20-2003, 05:13 PM
  5. File information in C
    By jakewendt in forum C Programming
    Replies: 2
    Last Post: 10-11-2002, 04:12 PM