Sign in to follow this  
kristoferos

string manipulation

Recommended Posts

kristoferos    122
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
iMalc    2466
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
kristoferos    122
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this