Results 1 to 10 of 10

Thread: Is there such a way QFileInfo

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is there such a way QFileInfo

    In that case you can't do it with Qt. Why would you want to do that anyway? The file is modified when it is written to the device, not when its original was written to some other device.
    Not entirely true. When you copy files cross device under windows (maybe linux and mac, not sure) the file time will be preserved.

    Why not store the value elsewhere? Or use platform dependent code as already suggested.
    I'm pretty sure it can be done using standard c, read a file's attributes into a 'struct stat' then change the member you're interested in then apply them back somehow.
    I did it years ago but can't remember how atm.

  2. #2
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is there such a way QFileInfo

    Hmm that was a dopey thing to say.
    The file creation time is set as the time written to the target device.

  3. #3
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is there such a way QFileInfo

    Actually I did it on a linux system, I think you need to use utime to do it.
    There doesn't seem to be any standard support for it, I think mainly because the FS stuff is so specific to the OS.

    Use utime for BSD and SetFileTime for windows. If you want it cross platform, you'll most likely need to write your own cross platform logic for it.

Similar Threads

  1. 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
  •  
Qt is a trademark of The Qt Company.