|
Post by Kelly Ethridge on Nov 2, 2006 1:31:00 GMT -5
An easy way to read an entire file into a byte array is to use the File.ReadAllBytes method.
Dim b() As Byte b = File.ReadAllBytes("MyFile.exe")
This reads an entire file into a byte array without out needing to deal with any of the native VB commands.
To write an entire byte array as a new file, use the File.WriteAllBytes method.
Dim b() As Byte ' Fill array with data File.WriteAllBytes "MyFile.exe", b
This will write out the bytes to the file, overwriting the file if it already exists.
File methods on NT machines use the wide API methods, so the path name is limited to only 32767 characters. Win9x machines are still limited to 260 characters.
|
|