-
March 1st, 2012, 04:41 PM
#1
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
-
March 1st, 2012, 04:58 PM
#2
Re: inserting binary data in a STL List
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
-
March 1st, 2012, 06:35 PM
#3
Re: inserting binary data in a STL List
thx paul found the answer surfing in the net
mylist.push_back(std::string(buff, bytesread));
-
March 1st, 2012, 07:02 PM
#4
Re: inserting binary data in a STL List
There's also a vector<char> if you have any doubt.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|