Reputation:
I have C++ program which writes to a file, while a PHP code can simultaneously reading from this file.
If the reading PHP process opens the file at the same time the C++ program has opened that file, can this cause some problem ?
If so, what should the best way for this kind of communication ?
I think a pipe should be always the best solution in this cases. Is it ?
Upvotes: 0
Views: 65
Reputation: 53525
Write to a temp file and after you're done rename/move the temp file to the original. This process ensures that you won't read 'half baked' file from your php code.
Upvotes: 1