please help!! filesystem problem...

I open a file using fstream as fstream streama(“myfile”, ios::out); then
writing some data to that file, like streama << myobject , assuming myobject
has << overload function.

From the filemanager, i can see the file’s data been changing as the
software keep updating myobject’s values., but when i shutdown the computer
right the way and turn it back on, the file still contains original
myoject’s data.

I have to wait about at least 15 seconds after the last streama << myobject
is been called , then turn the computer off and back on, then it shows the
new data… why taking so long??

I tried to call streama.flush() after each streama << myobject, it writes
garbage to myfile.

please help!!!