SQLite as an Application File Format (2014)
“Atomic transactions” is a feature needs <i>formal</i> support in random file formats way more often than people realize. Simply writing to a file at all in an guaranteed-atomic way is much harder than it looks. That guarantee becomes important when your app gets widely distributed.  If you have a million users of your free mobile app, 1 in a million events happen every day. For example: random hardware shutdown midway through a file write operation.  How is your app going to react when it reads back that garbled file?<p>I’ve used SQLite on mobile apps to mitigate this problem. I’ve used LMDB on a cloud app where the server was recording a lot of data, but also rebooting unexpectedly.  Would recommend. I’ve also gone through the process of crafting an atomic file write routine in C. <a href="https:&#x2F;&#x2F;danluu.com&#x2F;file-consistency&#x2F;" rel="nofollow">https:&#x2F;&#x2F;danluu.com&#x2F;file-consistency&#x2F;</a> It was “fun” if your idea of fun is responding to the error code of fclose(), but I would not recommend...