• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Change Date

How do I change the dates of a file I opened? I used to be able to do it in DOS environment using Turbo C. But Windows/MFC doesn't seem to offer this feature anymore. What it offers is to use CFileStatus class, which uses 64-bits clock ticks from 1601 March 1. I don't want to do the conversion myself because it is a lot of hassle. Any suggestion?
0
tangkh
Asked:
tangkh
  • 3
  • 2
1 Solution
 
jkrCommented:
Simply use the 'SetFileTime()' Win32 API, it is designed for this task ;-)
0
 
tangkhAuthor Commented:
this is my point, i dont want to use the tick count (interval of 100 ns). i want to, says, change the file's date by simply typing only 1998:11:23 to change it. I am not going to do the conversion from the tick count to the date... :(
0
 
jkrCommented:
You're right - it IS a hassle ;-)

But there are several convenience functions that allow the conversion of common time formats into FILETIME structures, e.g. 'DosDateTimeToFileTime()' which can be used to create FILETIME. So you could e.g. still use the 'strftime()', 'asctime()' etc.

0
 
tangkhAuthor Commented:
Hohohoho ^o^ you deserved the points. I have been struggling to get this type of function. Thanks :)
0
 
jkrCommented:
Thanks ;-)
Glad i could help you!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now