#define LEN_PING_PANG (48000) //1 seconds typedef struct S_PINGPANG { void* p1 ; void* p2 ; int position; }PINGPANG; PINGPANG * Ping;
这里是结构和变量的定义
Ping = malloc(sizeof(PINGPANG)) ; Ping->p1 = malloc(LEN_PING_PANG) ; Ping->p2 = malloc(LEN_PING_PANG) ; Ping->position=0;
初始化
if (Ping != NULL){ free(Ping->p1) ; free(Ping->p2) ; free(Ping) ; }
释放资源
void* savePingPang(void* p, int len) { if (len<=0) { if (Ping->position < LEN_PING_PANG) { memset(Ping->p1+Ping->position,'