vendredi 27 février 2015

Does Windows allow simultaenous writing to a file?

I've created a c++ program using Qt that writes to a file. It is likely this program will have multiple instances, with each instance accessing the file over a local network.


I'm using QFile::ReadWrite as my file open options. If one process opens the file in this mode, I've found that the other process can also open it for writing. I use file.write(text) to write to the file. What would happen if both processes tried to do this at exactly the same time? Does Windows handle this?


I am wondering whether to re-implement using the Window's CreateFile(...) and using 0 for the sharemode is required?


Thanks.


Aucun commentaire:

Enregistrer un commentaire