I need to create big relatively big (1-8 GB) files. What is the fastest way to do so on Windows using C or C++ ? I need to create them on the fly and the speed is really a
Well this solution is not bad, but the thing you are looking for is SetFileValidData
As MSDN sais:
The SetFileValidData function allows you to avoid filling data with zeros when writing nonsequentially to a file.
So this always leave disk data as it is, SetFilePointerEx should set all data to zeros, so big allocation takes some time.