How to get the size of a binary string?
length() and size() both stops at a \0 character.
Code:// string::length
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Tes\0t string");
cout << "The length of str is " << str.length() << " characters.\n";
cout << "The length of str is " << str.size() << " characters.\n";
return 0;
}