adamandhelen
04-23-2003, 04:22 AM
i need to read from a file, which i think is a binary file. when opened in notepad/wordpad i just get a series of squares, therefore i am assuming its binary. i actually need to read a set series of bytes (4) and convert these bytes into decimal(or hex) - so i can evaluate what info has been stored-. i also need to read these 4 bytes from a specific area within the file so i have an offset written in hex that needs to be used. if i use the mid$ function, and specifiy the length as byte will this actually read 4 bytes? and can i use the offset as the start position?
ie
dim any as byte
string=mid$(file, offset ,4)
i have read various posts that i may need to swap the bytes. if so do i need to swap the 4 bytes around as such: byte4,byte3,byte2,byte1 and then reverse it:byte1,byte2,byte3,byte4 or do i need to swap the figures in each individual byte?
what will the resulting string actually contain? or how would you convert this string to decimal/hex
hope this makes sense but i have never needed to read by bytes and use offsets before.
thanks
ie
dim any as byte
string=mid$(file, offset ,4)
i have read various posts that i may need to swap the bytes. if so do i need to swap the 4 bytes around as such: byte4,byte3,byte2,byte1 and then reverse it:byte1,byte2,byte3,byte4 or do i need to swap the figures in each individual byte?
what will the resulting string actually contain? or how would you convert this string to decimal/hex
hope this makes sense but i have never needed to read by bytes and use offsets before.
thanks