inserting binary data in a STL List
inserting binary data in a STL List
is that a good practice?
typedef list<string, allocator<string> > LISTSTR;
LISTSTR BL;
how do would i insert a element with explicit lenght since binary data messes the null used to delimit c style strings...
i ve heard that stl::strings stores the lenght explicily without the need of the null delimiter
Re: inserting binary data in a STL List
Quote:
Originally Posted by
Alphadan
inserting binary data in a STL List
is that a good practice?
typedef list<string, allocator<string> > LISTSTR;
LISTSTR BL;
how do would i insert a element with explicit lenght since binary data messes the null used to delimit c style strings...
i ve heard that stl::strings stores the lenght explicily without the need of the null delimiter
Look at the the std::string interface.
You can construct strings using a length argument, and you have the string::append() function to concatenate binary data.
http://www.cplusplus.com/reference/string/string/
http://www.cplusplus.com/reference/s...string/string/
Regards,
Paul McKenzie
Re: inserting binary data in a STL List
thx paul found the answer surfing in the net
mylist.push_back(std::string(buff, bytesread));
Re: inserting binary data in a STL List
There's also a vector<char> if you have any doubt.