string manipulation
Hello, I'm not sure how I would do this but I want do insert a checksum into a certain part of a packet and obviously this has to be done after every other bit of information has been put into the packet. I was wondering if any of you knew how I would insert a string(checksum) into an existing string, preferably without using std::string.
Thanks in advance.
What? What are you using for the string then?
Do you want to insert it as ACSII hexidecimal so it's readable?
Or is this actually a packet structure that has a word to store the check-sum in?
Do you want to insert it as ACSII hexidecimal so it's readable?
Or is this actually a packet structure that has a word to store the check-sum in?
I suggest using a CRC instead. Checksums aren't as robust.
You could format the resulting CRC with sprintf(buf, "%.04X", mycrc); for example.
You could format the resulting CRC with sprintf(buf, "%.04X", mycrc); for example.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement