![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Change a file's timestamp | shibajighosh | AIX | 6 | 05-27-2008 01:26 PM |
| Retrive deleted file's info | asmita | UNIX for Advanced & Expert Users | 4 | 03-27-2007 01:36 AM |
| get a file's timestamp | shihabvk | UNIX for Advanced & Expert Users | 1 | 05-30-2005 06:18 AM |
| checking file's permissions and change them | K-ONE | Shell Programming and Scripting | 7 | 04-10-2005 09:09 AM |
| best way to get a file's size? | ropers | Shell Programming and Scripting | 5 | 03-21-2004 09:05 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Set file's timestamp
Hello all,
In C - Is there a way of setting a timestamp for a file, and keeping it unchanged? Status information of the file in structure stat is modified automatically, and therefore, as I understand, is not good for that purpose ... ... Thank you in advance. |
|
||||
|
If other users can access the file, you cannot stop them from updating the timestamp on the file. If you open the file, then read or write the file you can get the file's mtime from a stat call, then when you are done with the file, you can reset filetimes with a utime call, using the data you got from stat.
All this sounds bogus to me. What are you trying to accomplish? not how to do what you are attempting to do that looks odd. It may be what you have to do, but I kind of doubt it. |
|
||||
|
Look at the GNU C code for touch. Download from here:
http://ftp.gnu.org/gnu/coreutils/ Normally the kernel/filesystem maintains timestamps so you would have to look at that code if your OS is opensource. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|