Splitting string in chunks of 2 characters

This is a discussion on Splitting string in chunks of 2 characters within the C++ Programming forums, part of the General Programming Boards category; I have a string of type std::string, and I want to split it so that 210100 would become 21 01 ...

This function works with two arguments, the original string and the final string (result). It seems to be like the out string is of type vector, but what it is. I also want to know if there's any way I can make it a std::string.

This is NOT a vector. This is an array, but it's something different. This is a built-in array type and it has fixed size. Vector is an array too, but it's a dynamic one, which can grow and shrink in size. You could split your string to this kind of array too, but you will have to set limit for length.