• Advertisement
Sign in to follow this  

string manipulation

This topic is 4552 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites
I suggest using a CRC instead. Checksums aren't as robust.
You could format the resulting CRC with sprintf(buf, "%.04X", mycrc); for example.

Share this post


Link to post
Share on other sites
Yes this is a packet structure where the checksum is in the header in hexadecimal. I wanted to know how I could insert this between the data once it has been calculated.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement