string manipulation

Started by
2 comments, last by kristoferos 18 years, 8 months ago
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.
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?
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I suggest using a CRC instead. Checksums aren't as robust.
You could format the resulting CRC with sprintf(buf, "%.04X", mycrc); for example.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
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.

This topic is closed to new replies.

Advertisement