any suggestion on how to strip characters from char array pass as pointer in C++. i must use memcpy function to copy.
void foo(char *test)
{
char a[1] = {0};
char b[1] = {0};
char c[1]= {0};
memcpy(&a,&test[0],1);
memcpy(&b,&test[1],1);
memcpy(&c,&test[2],1);
cout << a <<endl;
cout << b <<endl;
cout << c <<endl;
}
int main()
{
char uibuffer[4] = "ABC";
foo(uibuffer);
return 0;
}
the current output is:
ABC��
BC��
C��
desired output is:
A
B
C