>> I'm trying to detect data corruption on a usb hard drive.
>> My test program writes then reads the disk, but never finds
>> any corruption. But if I unmount/unplug and replug the usb, the
>> corruption appears.
>>
>> It occurs that Windows 2k/xp may have cached the small files.
>> Since the changes didn't come thru the OS, the OS thinks the
>> data is good and just hands me what's in the cache from the previous
>> read.
>> I'm trying to do this with simple VB6 (legacy) code:
>>
>> Open filenamestring For Input As #1
>> inputstring = Input(14, #1)
>> Close #1
>>
>> to keep it simple.
>>
>> Is there a way to force the OS to flush the disk buffers/cache and give
>> me what's actually on the disk the next time I open the file?
>>
>> Or maybe force an unmount/remount the usb drive?
>>
>> Or do I need a more complicated file handler?
>>
>> Or maybe I'm barking up the wrong tree??? Better tree?
>>
>> I've googled for cache, flush, buffer and unbuffered and every
>> combination I can think of. Nothing useful found.
Thanks, mike

Signature
Return address is VALID!
expvb - 24 Jan 2008 07:27 GMT
Check FILE_FLAG_NO_BUFFERING flag description in CreateFile(). I never tried
it though.