Problems with file buffers. Flushing synchronously
Posted on 2004-04-15
I am trying to write a file to and then I want to ensure that all the data is written to it. I was going to the the flush command, but snooping on a serial port I can see that the file buffer is not fully flushing the file.
I'm converting from Windows to Linux and in Win I see that it uses flushfilebuffers on a drive letter so I was going to do the same on the drive relating to the device : /dev/sdf
In the fstab file I have configured my drive to be synchronous :
/dev/sdf /media/mydisk auto noauto,users,exec,sync 0 0
Now this seems to help but the final portions of the file are not copied and because of this my program cannot complete the updating command.
I am using QFile, this is my code:
I have also tried flushing the actual device /media/myDisk, but this does not make any difference either.
Atm I am getting round the problem by going to sleep for a while until the delayed write finishes but this is not really much of a solution.