asio 笔记

char buf[512]=0 ;

string msg ="test body";

head_t head = {1234,msg.longth,'1'};

memcpy(buf,&head,sizeof(head));  //head struct {int key;int len;char zip;}

如果 用string 接收buf ,会不正确。含有结构体,还是用char[],好些。

posted @ 2014-06-17 13:38  anjsxz  阅读(95)  评论(0编辑  收藏  举报