C++ Question buffer[x](char type) to return data to a interger or reference point of buffer to a another struct then get variable from the struct??
Posted on 2004-08-30
I would like to know this specific typecast conversion which I not sure how to procede.
unsigned short A;
Let'ss assume that Buffer as been assigned and all that.
Let's also assume that Buffer to Buffer has the B value of 123456
Ok I need to do smething like this.
MyS = (MyStruct *) Buffer;
I suppose that MyS is now at the exact same address has of Buffer concerning the first byte.
So then Mys.B should be equal to 123456 but it does not seam to work, mine is always 0
Anyway Help about this typecast or whatever other term we could give it;
Basily what I need is that one struct shadow the Buffer at whatever possible because I could and will start MyStruct
at any position in the Buffer and would like to et the data in the pointer through the "avatar" MyS.B for example unless
you can get you data as for example a long type from a buffer that have a array of char from whatever position??
One more thing is that I want to get this info into a normal variable like long Test = MyS.B which should be equal to
123456 for example and not zero.