WinAPI WriteFileEx Buffer Question

The WriteFileEx function in the WinAPI writes the given buffer to a file asynchronously, but I want to add data to that buffer if its still writing. Is there a way to do that with the WinAPI or do I need to write my own module to do that?
No, you can't change the buffer once you've issue WriteFileEx. It's processed asynchronously, so there's no way to know if you're clashing with the background write.

You must wait until WriteFileEx has completed.

Why would you want to do that anyway?

If you want to change some block of data outside of the range passed to WriteFileEx, then that's fine, but don't expect a previous call to WriteFileEx to process it.
Last edited on
Because I have some sensors, and I need to write the data from each sensor to a file. I get the data from that sensor every x miliseconds (usually 250) and I want to keep writing that to the disk.

But ok, thanks, I'll write my own buffer.
You can still write asynchronously. It's not faster to write synchronously, and there's no blocking.
Topic archived. No new replies allowed.