Guest User

Untitled

a guest
Jan 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. //example values
  2. str = "<Request Type="Query" Version="1.0"></Request>"
  3. uintcrc = getCrc(str, strlen(str));
  4.  
  5. //code i don't understand
  6.  
  7. //create a byte array with a null terminator?
  8. memset(strQueryBuffer, '', sizeof(str));
  9. //print the values into the byte array
  10. sprintf(strQueryBuffer, "%c%s%c", COMM_STX, str, COMM_ETX);
  11.  
  12. //append the uintcrc to the end of the byte array?
  13. memcpy(strQueryBuffer + strlen(strQueryBuffer), &uintcrc, sizeof(uintcrc));
  14.  
  15. strQueryBuffer = COMM_STX + "<Request Type='Query' Version="1.0"></Request>" + COMM_ETX + Encoding.Ascii.GetString(BitConverter.GetBytes(uintcrc));
  16.  
  17. var str = "<Request Type='Query' Version="1.0"></Request>";
  18. byte[] Data = (new [] { COMM_STX }).Concat(Encoding.Ascii.GetBytes(str)).Concat(new [] { COMM_ETX }).Concat(BitConverter.GetBytes(uintcrc)).ToArray();
  19.  
  20. strQueryBuffer + strlen(strQueryBuffer)
  21.  
  22. &strQueryBuffer[strlen(strQueryBuffer)]
Add Comment
Please, Sign In to add comment