I just Googled
this[
^] and there are a number of references to .X file formats on the web. I suggest you try the same and go from there. Note, having browsed one of the file descriptions I think this is a non-trivial exercise, you may be better searching for a library that supports access to these file types.