Well, I don't know why it's failing (you didn't show us
the code that reads the data for instance), but I do know
this is going to fail if you are getting two requests in
a short time. The first thing that happens when you open
the file for write is that it's getting truncated. What if
another instance is reading from the file? What if another
instance is also writing? Your data will get corrupted.
Also, you open the file, and you don't check the return value.
What if the file cannot be opened? Same for the close, you
might get an error here (disk full, for instance). You don't
check.
Abigail