C/C++ code#include "stdio.h"
#include "string.h"
typedef struct
{
int nData;
char chData;
}Tstruct1;
typedef struct
{
int nData;
char chData;
short wData;
}Tstruct2;
Tstruct1 tTestt1 = {100, '1'};
Tstruct2 tTestt2 = {200, '2', 20};
const char *Stable[]=
{
(const char *)(&tTestt1),
(const char *)(&tTestt2),
};
void GetStructT(int type, void *pvOutBuf, int dwLen)
{
char *lpstrBuf = NULL;
lpstrBuf = (char *)(Stable[type]);
memcpy(pvOutBuf, (char *)lpstrBuf, dwLen);
}
void SetStructT(int type, void *pvOutBuf, int dwLen)
{
char *lpstrBuf = NULL;
lpstrBuf = (char *)(Stable[type]);