TMyQueue//putdataintoqueue{QueueDatadatamemset(&data,0,sizeof(data))strcpy(data.data,"hello!")data.nId=0m_pMyQueue.TryPut(data)}//tryputdataintoqueue{QueueDatadatamemset(&data,0,sizeof(data))strcpy(data.data,"hello!")data.nId=0if(m_pMyQueue.TryPut(data)!=0){MessageBox("putqueueerror")}else{MessageBox("putqueuesuccess")}}//getdatafromqueue{QueueDatadatamemset(&data,0,sizeof(data))m_pMyQueue.Get(data)MessageBox(data.data)}//trygetdatafromqueue{QueueDatadatamemset(&data,0,sizeof(data))m_pMyQueue.TryGet(data)MessageBox(data.data)}-cohortofVCPackagingcategory///////////////////////////////////////////thisisaexampleforusingQueue///////-IMDN开发者社群-imdn.cn"> TMyQueue//putdataintoqueue{QueueDatadatamemset(&data,0,sizeof(data))strcpy(data.data,"hello!")data.nId=0m_pMyQueue.TryPut(data)}//tryputdataintoqueue{QueueDatadatamemset(&data,0,sizeof(data))strcpy(data.data,"hello!")data.nId=0if(m_pMyQueue.TryPut(data)!=0){MessageBox("putqueueerror")}else{MessageBox("putqueuesuccess")}}//getdatafromqueue{QueueDatadatamemset(&data,0,sizeof(data))m_pMyQueue.Get(data)MessageBox(data.data)}//trygetdatafromqueue{QueueDatadatamemset(&data,0,sizeof(data))m_pMyQueue.TryGet(data)MessageBox(data.data)}-cohortofVCPackagingcategory///////////////////////////////////////////thisisaexampleforusingQueue/////// - IMDN开发者社群-imdn.cn">
登录
首页 » 通信 » VC++ 封装了队列类 /// /// /// ///// //this a example for using Queue /////////////////...

VC++ 封装了队列类 /// /// /// ///// //this a example for using Queue /////////////////...

于 2023-07-24 发布 文件大小:33.71 kB
0 33
下载积分: 2 下载次数: 1

代码说明:

VC++ 封装了队列类 /// /// /// ///// //this a example for using Queue ///////////////////////////////////////// #include "Queue.h" //define queue data struct struct QueueData { char data[20] int nId } //define queue typedef TQueue TMyQueue //put data into queue { QueueData data memset(&data, 0, sizeof(data)) strcpy(data.data, "hello!") data.nId = 0 m_pMyQueue.TryPut(data) } //try put data into queue { QueueData data memset(&data, 0, sizeof(data)) strcpy(data.data, "hello!") data.nId = 0 if(m_pMyQueue.TryPut(data) != 0) { MessageBox("put queue error") } else { MessageBox("put queue success") } } //get data from queue { QueueData data memset(&data, 0, sizeof(data)) m_pMyQueue.Get(data) MessageBox(data.data) } //try get data from queue { QueueData data memset(&data, 0, sizeof(data)) m_pMyQueue.TryGet(data) MessageBox(data.data) }-cohort of VC Packaging category /////////////////////////////////////////// this is a example for using Queue ///////

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696518资源总数
  • 104281会员总数
  • 62今日下载