Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. char DataBuffer[2] = { 0x06 }; //Hex for ACK
  2. BOOL bErrorFlag = FALSE;
  3. uint8_t * pTmpBuf = (uint8_t *)calloc(outputReportLength, sizeof(uint8_t));
  4. uint8_t * pAppBuffer = (uint8_t *)calloc(outputReportLength, sizeof(uint8_t));
  5. DWORD nRead;
  6.  
  7.  
  8. if (pTmpBuf == NULL)
  9. {
  10. //return error(“memory allocation failed”);
  11. }
  12. //
  13. // copy data to be sent, reserving the 1st byte for report ID
  14. //
  15. unsigned long Written = 0;
  16. memcpy(pTmpBuf + 1, DataBuffer, sizeof(DataBuffer));
  17. bErrorFlag = WriteFile(hDevice, pTmpBuf, outputReportLength, &Written, NULL);
  18. free(pTmpBuf);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement