Original Post
hey all,
i''m trying to code a class for outgoing packets in a network app, the way i''m trying to get it to work is to have the class''s internal buffer a std::string, and as i assemble the packet with data i can do things such as
mypacket += (long)0xFF;
mypacket += strLoginName;
mypacket += (short)0x0102;
etc etc... i understand how to overload the += operator, but i''m not entirely sure how i can append things such as long''s, and short''s to the string as exactly the data they are (ie if i have (long)32 i dont want to append "32" i want to append "\32\0\0\0" as in, 4 bytes, of exactly what data they are
someone suggested i use stringstreams for this, but that converts the values into text and is not what i want, im trying to make a data buffer for packets to throw through a socket.
