- Alternatives to Finite State Machines (FSM's)?
- Is it possible to simulate record locks in test methods?
- How to execute if condition inside option tag in Lightning Component
- Can we formulate our own Tafseer from our understanding of Qur'an?
- Days of fasting during shaban
- Saying Shahada for first time
- Is it permissable to shave the beard for medical reasons?
- Thickness of ripstop nylon, specifically the one used to make kites
- Is there a single or double bond between S and O in propanethial S-oxide?
- Help on alternative terpene names and naming schemes
- What is enthalpy change in Joule's experiment?
- How to adjust a reserved South Asian coworker to the casual culture of a Central European mid-size company?
- how can I install scikit learning?
- Count all paths between two vertices
- CSMA/CD with binary exponential backoff: Do both back off or just the loser?
- Physics or Engineering?
- What plants can be heard when they are growing?
- Looking for research on a game/dilema where a group of people can be killed by a specific action, that any one of them can perform
- The computer model of the brain
- What is the taxonomy of a musical hook?
C# code converted from C++ not working
Consider the following C++ code which sends data over RS232 to a device.
iTmp = finalizeNL20Message(m_MsgBytes, 4);
int CVTSSLTNL20Message::finalizeNL20Message(BYTE *pMsgData, int iInLen)
ucMsg = MSG_STX; // 0x02
ucMsg = NL20_BLOCK_ID; // ox01
ucMsg = ATTR_CMD; // 'C'
memcpy(&ucMsg, pMsgData, iInLen);
ucMsg[3 + iInLen] = MSG_ETX;
ucMsg[4 + iInLen] = calculateNL20Checksum(ucMsg, 4 + iInLen);
ucMsg[5 + iInLen] = MSG_CR;
ucMsg[6 + iInLen] = MSG_LF;
memcpy(pMsgData, ucMsg, 7 + iInLen);
return 7 + iInLen;
BYTE CVTSSLTNL20Message::calculateNL20Checksum(const BYTE *pData, int iInLen)
BYTE ucChk = 0;
for (int iCnt = 0; iCnt < iInLen; iCnt++)
ucChk = ucChk ^ pData[iCnt];
I've rewritten this code in C# as the following:
public static string Generate()