resbuf
struct resbuf {
struct resbuf *rbnext;
short restype;
union ads_u_val resval;
};
union ads_u_val {
ads_real rreal;
ads_real rpoint[3];
short rint;
ACHAR *rstring;
__w64 long rlname[2];
__w64 long mnLongPtr; // use this instead of rlong for pointers
long rlong; // a 32-bit integer value
__int64 mnInt64; // a 64-bit integer value
struct ads_binary rbinary;
unsigned char ihandle[8];
};
acutNewRb acutRelRb
struct resbuf * acutNewRb(
int type);
int acutRelRb(
struct resbuf * rb);
常见的类型有:
- RTSHORT
- RTLONG
- RTINT64
- RTREAL
- RTSTR
- RTPOINT
- RT3DPOINT
使用acutNewRb申请的resbuf,需要配对使用acutRelRb来释放内存空间。
对于RTSTR
resbuf* rb = acutNewRb(RTSTR);
acutNewString(_T("HelloWorld"), rb->resval.rstring);
......
acutUpdString(_T("WuHan HuaShan"), rb->resval.rstring); // acutUpdString会释放掉前一个rb->resval.rstring指向的内存空间,再重新申请内存空间
......
acutRelRb(rb);
acutBuildList
struct resbuf* result = NULL;
ads_point pt1 = { 1.0, 2.0, 5.1 };
result = acutBuildList(
RTREAL, 3.5,
RTSTR, _T("Hello, there."),
RT3DPOINT, pt1,
0);
......
acutRelRb(result);