how to when use a file can't delete the file

  • Hi
    When i load a file to my app should can't delete or rename the file, when my app using the file.
    how to do this?

  • Check QLockFile

  • @VRonin how to use correctly?
    this my code :

    QLockFile lf("J:/file.txt");

    whit this code file deleted & app crash(exit code 1073741845) & anti virus alert me my app is virus!

  • please read the description of the class

    For the use case of protecting a resource over a long time, you should therefore call setStaleLockTime(0), and when tryLock() returns LockFailedError, inform the user that the document is locked, possibly using getLockInfo() for more details.

  • @VRonin thank you but can you show me a example

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.