fd_map=open(path, O_CREAT|O_RDWR|O_TRUNC, 00777); write(fd_map," ", sizeof(CPipegData)); pmap = (CPipeData*) mmap( NULL,sizeof(CPipeMsgData), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); |
pMsg->dwPduLenth = pmap->Msgdata.msgLenth; if(pmap->Msgdata.pMsgData && pMsg->dwPduLenth != 0) { pMsg->pMsgBuf = new unsigned char[pMsg->dwPduLenth + 1]; memcpy(pMsg->pMsgBuf, pmap->Msgdata.pMsgData, pMsg->dwPduLenth); pMsg->pMsgBuf[pMsg->dwPduLenth] = '\0'; } |
class CMsg { .......... int dwPduLenth; unsigned char *pMsgBuf; } typedef std::list<CMsg *> CMSGLIST; |
CPipegData msgData; fd_map=open(path, O_CREAT|O_RDWR|O_TRUNC, 00777); write(fd_map, (void*)&msgData, sizeof(CPipegData)); pmap = (CPipeData*) mmap( NULL,sizeof(CPipeMsgData), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); |
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |