Reading data with various formats in C ++

I create my first real binary parser (tiff reader) and ask a question about how to allocate memory. I want to create a structure in my TiffSpec class for IFD records. These records will always be 12 bytes, but depending on the type specified in this particular record, the values ​​at the end may have different types (or maybe just an address to another place in the file). What would be the best way to make such data? The smallest sized memory that I assume will have 1 byte.

+3
source share
1 answer

In C ++ you have to use union.

, , , .

. , - .

+5

Source: https://habr.com/ru/post/1703202/


All Articles