Type conversion from type Elf32_Ehdr to type const char
Rupert Wood
me@rupey.net
Thu Jun 13 03:10:00 GMT 2002
Edwin Chan wrote:
> I would like to know how to convert from type Elf32_Ehdr to
> type const char
Why? It's a structure. It doesn't make sense to try and convert it to a
single character value.
If you really want a const char pointer, I think that would be
reinterpret_cast:
Elf32_Ehdr Ehdr;
const char* tmp = reinterpret_cast<const char*>(Ehdr);
If you just want the first byte of the structure then you could
dereference this pointer (e.g. with [0]) to get it. However, if what you
really want is the first byte of the ident sequeunce, you should use
'Ehdr.e_ident[0]'.
Rup.
More information about the Gcc-help
mailing list