#define INVALID_HANDLE_VALUE -1 && (HANDLE)-1 #define GENERIC_READ 2147483648 && (0x80000000L) #define GENERIC_WRITE 1073741824 && (0x40000000L) #define FILE_SHARE_READ 1 && 0x00000001 #define FILE_SHARE_WRITE 2 && 0x00000002 #define FILE_SHARE_DELETE 4 && 0x00000004 #define CREATE_NEW 1 #define CREATE_ALWAYS 2 #define OPEN_EXISTING 3 #define OPEN_ALWAYS 4 #define TRUNCATE_EXISTING 5 #define FILE_FLAG_BACKUP_SEMANTICS 33554432 && 0x02000000 clear dlls declare integer FlushFileBuffers in win32api as W32FlushFileBuffers long tnHandle declare long CreateFile in win32api as W32CreateFile string tcFile, ; long tnAccess, long tnShareMode, string tcSecurity, long tnCreation, long tnFlags, long tnTemplate declare integer CloseHandle in win32api as W32CloseHandle long tnHandle lnCt = 100 lnTime = seconds() for lnX = 1 to lnCt *do FlushIt with "\\.\c:" *do FlushIt with "\\.\d:" do FlushIt with "\\.\C:\Code\MyData", .t. next && lnX lnTime = seconds() - lnTime ? "Flushes: " + alltrim(str(lnCt)) ? "Time: " + alltrim(str(lnTime, 18, 2)) ? "Avg: " + alltrim(str(lnTime/lnCt, 18, 3)) ? procedure FlushIt lparameters tcFile, tlDirectory lcFile = tcFile && the thing we want to flush. lnAccess = GENERIC_WRITE && we need write access to do this. lnShare = FILE_SHARE_WRITE && be nice and share now. lcSecurity = 0 && null security descriptor lnCreate = OPEN_EXISTING && open existing, duh. lnFlags = iif(tlDirectory, FILE_FLAG_BACKUP_SEMANTICS, 0) && no flags lnTemplate = 0 && no template file lnHandle = W32CreateFile(lcFile, lnAccess, lnShare, lcSecurity, lnCreate, lnFlags, lnTemplate) *? "handle: " + alltrim(str(lnHandle)) if lnHandle = INVALID_HANDLE_VALUE ? "Unable to open " + tcFile else if W32FlushFileBuffers(lnHandle) = 0 ? "flushing handle failed" endif if W32CloseHandle(lnHandle) = 0 ? "closing handle failed" endif endif endproc && FlushIt