Hello, I should explain that by “born again newbie”, I’m referring to the fact that I studied Go quite extensively a few year ago, following the Todd McLeod courses. Since then I have been devoting my time to electronic music production and have evidently lost a lot of my Golang chops. Now through my music, a situation has arisen where I need to use my former Go powers, with some help from you guys!
I have a file format which is a mixture of binary and text. The text looks as if it can be converted to a Dictionary, with a series of keys such as “comment”, “author” etc. The text appears to be written with Pascal style strings where the text is preceded by a byte (or more) indicating the length of the strings.
The position of the text marked “comment” at 0x83 in the attached picture seems to be constant across all files of this type (note the length byte at 0x82 - is this part of a larger number structure covering the previous 3 bytes making it a 64 bit length, I wonder). But the position of all subsequent pieces of text can vary according to the content. All the files have the same collection of keys.
All the text I am interested in extracting is that which is contained in the first 0x0200 bytes, and ideally would consist of code which extracts the key/value pairs to a dictionary structure and prints it out.
I’m not looking for someone to provide me with an off-the-shelf solution. Instead, if anyone is willing to spend the time giving me a series of guiding prods to lead me in the right direction, I would be very grateful!
I’ve managed to get a file into a slice using
ioutil.ReadFile but am unsure how to continue. I suspect I’m going to have to use different interfaces to allow me to read the numeric data as well as the text data.