标题:谁能帮我解释一下这个小程序
取消只看楼主
chen_li
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-11-16
 问题点数:0 回复次数:0 
谁能帮我解释一下这个小程序
这段程序我看不懂,那位大侠帮忙看看,多谢!

/* 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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-33873-1-1.html




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

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