Original Post
Hi. I have a a little code that doesn't do the job, it's a function that gets as a a parameter **string allocates it in the function and return it with some data in it, the problem is that it doesn't return right, here is the code, if someone could help me understand what I'm doing wrong.. void CWideCharConvert::convertWideCharToString(WCHAR *wcharArr, char **string) { int wcharArrLength, i, k=0; char temp[10]; wcharArrLength = ::wcslen(wcharArr); string = new char*[sizeof(char)]; string[0] = new char[wcharArrLength * 6 + 1]; MyUniCode *pUni = (MyUniCode *)wcharArr; for(i=0; i < wcharArrLength; i++) { ::sprintf(temp, "%d%d", pUni->charValAndLang[k+1], pUni->charValAndLang[k]); if(k==0) { ::strcpy(*string, temp); } else { ::strcat(*string, temp); } k+=2; } } the 'string' is defined as : char **string = NULL; when the function end it is still NULL. Thanks