| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 715 人关注过本帖
标题:谁能帮我解释一下这个小程序
只看楼主 加入收藏
chen_li
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-11-16
收藏
 问题点数:0 回复次数:1 
谁能帮我解释一下这个小程序
这段程序我看不懂,那位大侠帮忙看看,多谢!

/* This method will send a CCNET command to the bill validator and wait for response from it. BufOut is a pointer to the array, containing the command. Array should contain a full command including STX, correct device address, length, command and 2 CRC bytes. BufIn is a pointer to an empty array, which will be filled with the validator’s response.

*/

int CCCRSProtocol::SendCommand(LPBYTE BufOut, LPBYTE BufIn)

{

ResetEvent(hRecieved);

iRecievingError=RE_TIMEOUT;

iBytesToRecieve=3;

COMPort.Send(BufOut,BufOut[2]);

if((BufOut[3]==ACK)||(BufOut[3]==NAK)) return RE_NONE;

if(COMPort.Recieve(BufIn,iBytesToRecieve))

{

if(BufIn[0]!=SYNC)iRecievingError=RE_SYNC;

else

if(COMPort.Recieve((LPBYTE)BufIn+iBytesToRecieve,BufIn[iBytesToRecieve-1]-iBytesToRecieve)) iRecievingError=RE_NONE;

else

{

iRecievingError=RE_DATA;

PurgeComm(COMPort.GetHandle(),PURGE_RXABORT|PURGE_RXCLEAR);

}

}

return iRecievingError;

}

搜索更多相关主题的帖子: command array pointer 
2005-11-17 16:57
aolong
Rank: 1
等 级:新手上路
帖 子:248
专家分:0
注 册:2005-10-11
收藏
得分:0 

窗口滑动协议
可以看看相关的书
不是一半句话能解释的
看了之后还不懂的地方可以问
不要问的太笼统了


奋斗之中,朦胧有你,一切已变的那么飘渺虚无...
2005-11-17 23:28
快速回复:谁能帮我解释一下这个小程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015689 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved