Qt: How to lock/prevent a file from being read while it is written?
问题 I am using Qt5 on Windows 7. In my current project I open a binary file in order to populate it with data coming from a TCP socket. Normally, after the file is populated, I close it and another application will read this binary file for further processing. Well, the problem is: The writing operation takes about 4-5 seconds (or even more) so I need to find a way to prevent the other application from reading from the binary file until the file is completely populated ... Here below is the code