Use `CAF::FileEditor` for all this.  You can read it like a normal file, and print to it and close it.