Hello! I’m writing a Qt/c++ program that should write and read data on a file, while another process does the same. What file format should I use to prevent conflicts?
Hello! I’m writing a Qt/c++ program that should write and read data on a file, while another process does the same. What file format should I use to prevent conflicts?
No file format will save you by itself since at the end of the day, xml, json, etc they are all plain text.
One solution would be to use some database (like sqlite if you are just doing things locally on your computer).
Another solution would be to have a single process that is responsible for writing the data, while all other processes send messages to it via a queue.
I like the solution of the single process, thank you very much!
sounds good, but you need to look into races.
if program A used what it reads to write back and program B writes in the meanwhile A’s work won’t be ok.
transactions solve this.