Converting c pointer types

Posted by bobbyb on Stack Overflow See other posts from Stack Overflow or by bobbyb
Published on 2010-06-09T02:40:55Z Indexed on 2010/06/09 2:52 UTC
Read the original article Hit count: 202

Filed under:
|

I have a c pointer to a structre type called uchar4 which looks like

{
    uchar x; 
    uchar y; 
    uchar z; 
    uchar w;
}

I also have data passed in as uint8*. I'd like to create a uchar* pointing to the data at the uint8* so I've tried doing this:

uint8 *data_in;
uchar4 *temp = (uchar4*)data_in;

However, the first 8 bytes always seem to be wrong. Is there another way of doing this?

© Stack Overflow or respective owner

Related posts about c

    Related posts about pointers