J
JustSomeGuy
I have a data structure that contains a buffer of character of lenght n.
The buffer in this case contains a string that is not null terminated.
at the moment to get a null terminated buffer I'm doing the following:
strncpy(buf, (const char *)data, n);
buf[n] = '\0';
string x(buf);
Surely there must be a better way to initialze the string x...
By the way is there such a thing as a Variant in C++ as there is in
Visual Basic?
The buffer in this case contains a string that is not null terminated.
at the moment to get a null terminated buffer I'm doing the following:
strncpy(buf, (const char *)data, n);
buf[n] = '\0';
string x(buf);
Surely there must be a better way to initialze the string x...
By the way is there such a thing as a Variant in C++ as there is in
Visual Basic?