If the array was null-terminated this would be pretty straight forward:
unsigned char u_array[4] = { \'a\', \'s\', \'d\', \'\\0\' };
std::string str
There is a still a problem when the string itself contains a null character and you try to subsequently print the string:
char c_array[4] = { 'a', 's', 'd', 0 };
std::string toto(array,4);
cout << toto << endl; //outputs a 3 chars and a NULL char
However....
cout << toto.c_str() << endl; //will only print 3 chars.
Its times like these when you just want to ditch cuteness and use bare C.