My project is saving acquisition data to a file. The data as: 900 bytes/sample, 500 samples/second. I receive each data sample from a data acquisition board. This sample will be checked and if it okay, my program will write it to a file. When I press a button (on the my program), the program will close the file.

I had a look the example above. The data stay in memory and only write to HDD after released pages. This method will faster a normal method in my program (I think that).

But in my program, I can write the data continue to end posision of file. But in this example, I must declare a fix array before mapping file. Can you find a any way to do with a file without knowing len?