I am new to vb. net, and would like to implement a method I used in vb6.
I need to write binary data to the hard drive ASAP. I am writting ~ 5Mbytes
of data (synchrously)every 5 seonds for several hours. I need to 'flush' the
data to the hard drive after each write so that I can respond to events in a
'real time' manner during the next 5 second of data collection.
In vb6 i used
Public Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long,
lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten
As Long, ByVal lpOverlapped As Any) As Long
to write the data quickly,and this method worked fine
In vb.net I cannot determine how to use the API 'filewrite'. I tried to use
'fileput()', however this method takes ~ 0.8 seconds. I can write the same
number of bytes using 'write' (in ~ 0.2 seconds) however this ONLY takes an
argument of a byte array. The data I have is in a short array.
Thus I would like to know how to EITHER
-- Use API write in .net
-- cast(?) my short array to byte array SO I can use 'write'
OR any method to QUICKLY write a large amount of data synchrously to hard
drive.
Any ideas? Thanks