How to get memory offset?

677 views Asked by At

I need to get memory offset from struct, the file is: https://github.com/BlastHackNet/mod_s0beit_sa/blob/master/src/samp.h I need to get

    struct stObject : public stSAMPEntity < object_info >
{
    uint8_t             byteUnk0[2];
    uint32_t            ulUnk1;
    int                 iModel;
    uint8_t             byteUnk2;
    float               fDrawDistance;
    float               fUnk;
    float               fPos[3];
    // ...
};

fPos memory offset( as 0x1111 ). I don't know how to do it. Please help me.

1

There are 1 answers

2
Buddy On

Take a look at the offsetof operator: http://www.cplusplus.com/reference/cstddef/offsetof/