Results 1 to 4 of 4

Thread: QFileInfo::created() Problem Under POSIX!!

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Question QFileInfo::created() Problem Under POSIX!!

    It is known that QFileInfo::created() does not get me the creation date and time for a file, but the last modified date. So, how can I get the true creation date under POSIX, that's Mac, Linux, etc.?

    Thank you.

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QFileInfo::created() Problem Under POSIX!!

    Unix doesn't store the file creation time; it only stores the most recent modification time, which can be changed by a mv, permission change or several other ways.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QFileInfo::created() Problem Under POSIX!!

    A POSIX file inode has last changed (ctime, changing time), the file content last modified (mtime, modification time), and last accessed (atime, access time). Some filesystems don't maintain the access time.

    You can get the create time on Windows systems using their API, http://support.microsoft.com/kb/188977, but I think their POSIX layer also returns the creation time (where supported) in the ctime member. OS X stores creation date in metadata associated with the file but you'd have to look at how that can be retrieved.

  4. #4
    Join Date
    Apr 2011
    Posts
    124
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: QFileInfo::created() Problem Under POSIX!!

    Pop up a query and ask the user when he created the file.

Similar Threads

  1. Replies: 9
    Last Post: 6th August 2010, 22:13
  2. POSIX/Win32 Port involving QProcess, QSharedMemory
    By sfabel in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2010, 23:00
  3. Problem with qextserialport on posix
    By bnilsson in forum Qt Programming
    Replies: 0
    Last Post: 13th June 2009, 16:12
  4. Launching and handling posix or win32 signals
    By Althor in forum Qt Programming
    Replies: 2
    Last Post: 20th November 2008, 07:34
  5. about QFileInfo
    By Pang in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2006, 10:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.