To be const-correct, change:
static void ascii2bcd(char* outbuf, int length, char* data)
You can then write:
static void ascii2bcd(char* outbuf, int length, const char* data)
bcd2ascii(data, 17, "35496200179252501");
It looks like you edited the code snippet but forgot to change the variable names consistently, so now you have result, xdts5data and test.
I then move the contents of the char* outbuf into a char like so:
If your char array has embedded null characters, you can still copy with a loop, or simply use std::copy() from <algorithm>. In fact, you have already written such a loop, methinks, to copy from the char* to the char.
I would now like to move the contents of result into another char, but I can't use strcopy because it truncates the data after the seventh character. I think this is because it is technically not a character anymore, so stops the copying.
Oh, yes, or memcpy(). By the way, have you considered using std::vector<char> or std::string?