[RESOLVED] Bytes to long integer
Hi, I'd like to get a certain value from an avi video, but I'm not really sure how to do this. Byte 4 - 7 contains the real size of an avi video. These 4 bytes need to be converted to a long integer (I think).
In the example (screenshot):
Byte 4 = EA
Byte 5 = B9
Byte 6 = 8C
Byte 7 = 0E
EA B9 8C 0E = 244103658 bytes (original file size).
Does anybody know how to get Byte 4 - 7 and convert it, so I get the long integer value?
Thanks.
http://img154.imageshack.us/img154/8524/screen9gn.png
Re: Bytes to long integer
Since a long integer is 4 bytes, just open the file and get them.
VB Code:
Dim lngFile as Long
Dim lngSize as Long
lngFile = FreeFile
Open FileName For Binary as #lngFile
Get #lngFile, 4, lngSize
Close #lngFile
Re: Bytes to long integer
VB Code:
Dim s1 As String * 2, s2 As String * 2, s3 As String * 2, s4 As String * 2, s As String, l As Long
s1 = "0E"
s2 = "8C"
s3 = "B9"
s4 = "EA"
s = "&H" & s1 & s2 & s3 & s4
l = s 'l will equal 244103658
I'll leave reading the bytes and stuffing them into the variables to you.
Re: Bytes to long integer