>I can't read an uint16 from a file for this reason:
So what's the problem? You have an answer and it's easy to do. Though there are nuances that make your code non-portable, not the least of which is the assumption that uint32 resolves to int and uint16 does not. You would probably be better off using long and short instead of uint32 and uint16, respectively. long is guaranteed to be at least 32 bits and short is guaranteed to be at least 16. Then to read "uint16" with sscanf, you can use the %hd specifier as described in the first link you provided.