ATS中常见的字符串操作2

来源:互联网 发布:日理万机的网络意思 编辑:程序博客网 时间:2024/06/10 04:30

比如把配置文件路径传递给一个状态机

TSCont management_contp = TSContCreate(management_update, NULL);  char *p = (char *)TSmalloc(config_path.size() + 1);    strcpy(p, config_path.c_str());TSContDataSet(management_contp, (void *)p);TSMgmtUpdateRegister(management_contp, TAG); 而获取时 直接const char *path = (const char *)TSContDataGet(contp);