|
typedef struct SUBST
{
int m;
int n;
int l;
} subst;
typedef struct MAINST
{
subst * substruct; //맨위스트럭쳐포함
int x,y,z;
char * k;
} mainst;
class TtestClass
{
public:
TtestClass();
~TtestClass();
void SizeOfStruct();
mainst * mainstruct; //두번째 스트럭쳐포함
};
void TtestClass::SizeOfStruct() // 이 클래스의 크기
{
mainstruct = new mainst;
mainstruct->k = new char
mainstruct->substruct = new subst;
mainstruct->x = 1;
mainstruct->y = 2;
mainstruct->z = 3;
mainstruct->k = "test";
mainstruct->substruct->m = 1;
mainstruct->substruct->n = 2;
mainstruct->substruct->l = 3;
// 여기서 mainstruct의 크기를 알려면? 어케해야 되죠?
int iNum = sizeof(*mainstruct) + sizeof(mainstruct->substruct);
// 이렇게 해도 안 되던데......
ShowMessage(IntToStr(iNum));
}
*** substruct와 캐릭터 포인터를 포함하고 있는 mainstruct의 size를 알수 있는 방법.. 없나요?
넘 어려워...
|