Skip to main content
gamedev.net
🔒 Locked

Boost::algorithm::replace_all help?

Started by VI2 2 replies 5.6k views
Original Post
VI2
VI2
Hello everyone, I've got an ethernet device that duplicates 0xFF values when being sent though it. So when I recieve data from it I needs to remove duplicate 0xFF values. I know I could right a crude string manipulation algo to do this but I was hoping to accomplish this with the boost algorithm replace_all. I've been trying to play around with it and it does let me do what I want. Any suggestions on what I might try? CommWinsock2::readLine(buff,length); boost::algorithm::replace_all(buff,0xFF+0xFF,(unsigned char)0xFF); Thanks in advance.
Vorpy
Vorpy
After a moment's reflection, I find it interesting that this comes up so soon after that big C vs C++ thread that included some discussions about what was considered intuitive or unintuitive in using character arrays and std::string.

0xFF+0xFF == 0x1FE

And besides this, boost::algorithm::replace_all is expecting strings for its second and third arguments, not chars.

Topic Locked

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

Sign in to reply to this topic.