Hi,
your use of Path2Name() looks OK to me. The way you pass the treenames out does not, though: you assign it the buffer values of the local variable “names”, which will be gone after the function returns. Instead you should copy it. Now the question is whether each treename[i] entry points to allocated memory when the function is called. I assume it doesn’t, as this explain the problems you saw with your second option of passing names[] to treenames[]. Try this instead:for (int i=0; i<ntrees; i++) {
treenames[i] = new char[names[i].Length() + 1];
strcpy(treenames[i], names[i].Data());
}
Axel.