rcd contains 10 chars, such as '1', '2'.... etc.
So why is it declared "unsigned char"?
the problem is how to pass the contents in rcd to str with
minimal cost?
If you know the length, and what to avoid unsightly casts
,
you can use the two argument template constructor for
std::string:
std::string s( rcd, rcd + N ) ;
Otherwise, reinterpret_cast can be used:
std::string s( reinterpret_cast< char const* >( rdc ), N ) ;
, or, if the "string" in rcd is '\0' terminated:
std::string s( reinterpret_cast< char const* >( rdc ) ) ;
But I think the source of your problem is the original
declaration. The usual convensions are:
characters: char
small integers: signed char
raw memory ("bytes" or bits): unsigned char