Skip to main content
GameDev.net gamedev.net
🔒 Locked

string manipulation

Started by kristoferos Aug 1, 2005 at 4:39 PM 2 replies 800+ views
Original Post
kristoferos
kristoferos
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.
Shannon Barber
Shannon Barber
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
iMalc
iMalc
I suggest using a CRC instead. Checksums aren't as robust.
You could format the resulting CRC with sprintf(buf, "%.04X", mycrc); for example.
kristoferos
kristoferos
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.