Skip to content

Instantly share code, notes, and snippets.

@onqtam
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onqtam/9667987 to your computer and use it in GitHub Desktop.
Save onqtam/9667987 to your computer and use it in GitHub Desktop.
#include <string>
#include <cstring>
using namespace std;
int main() {
string a("\0A");
string b("\0B", 2);
cout << a.length() << endl; // 0
cout << b.length() << endl; // 2
cout << strlen(a.c_str()) << endl; // 0
cout << strlen(b.c_str()) << endl; // 0
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment