binary file?

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

phinds
04-23-2003, 05:36 AM
since you don't say what kind of data is there or how it was PUT there, it is literally impossible to say whether or not you will need to sway the bytes. To give an answer that is as specific as your quesion, you might or you might not.

adamandhelen
04-23-2003, 08:34 AM
the source file is DVD Ifo file (normally opened with IFOEDIT). however i want to have full control over the file from within vb. as a result i have no idea how it was put there. can this be determined from the file. i would add that the first 12 characters are always text. the information within the ifo file will only ever be a 0 or 1. depending on where it is in the file dictates what the 0 or 1 represents.

my orginal approach was to shell ifoedit and open the file. then use send/post message to control the buttons. however i would need to be able to read a treeview list and search it for specific parameters. after posting in the forum some help with treeviews and how to search, i got no response. therefore i would like to try reading the ifo file myself.

does this help with my original post.

i have read somewhere out there that the ifo file is created with x86? is this right?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum