I have preferences file for my application in Qt.
Whenever I launch the application it loads the file & depending the contents creates the widgets accordingly. I have given some customisation option for the user. Now when my application is closed I am checking whether the preferences are changed. If yes then I am opening the preferences file again & then just adding everything again in it. I am not creating a temporary file, I am directly editing the file. Is this method an efficient one? or am I doing it wrong? because I found these threads:
1. [What is the best way to edit the middle of an existing flat file?](https://stackoverflow.com/questions/732469/what-is-the-best-way-to-edit-the-middle-of-an-existing-flat-file)

2. <http://qt-project.org/forums/viewthread/25924/>

Should use I binary file? Currently I am using ASCII file.
Thanks.

UPDATE: In the stackoverflow link above the correct answer has

> 
> If you're stuck using flat, then you're stuck using the old fashioned
>  way of updating them
> 
> 
> 

I meant to ask whether the method I am using is old fashioned & is there a better method used nowadays? & what does flat file mean?