The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-19-2008
klafte klafte is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 10
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.
  #2 (permalink)  
Old 11-19-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,749
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.
  #3 (permalink)  
Old 11-23-2008
klafte klafte is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 10
Hello Jim,
What I was trying to do was simulating functions of an OS, which enables manually setting timestamps on files.

Thank you very much for your reply.
  #4 (permalink)  
Old 11-23-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,749
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0