0

I have a wstring that I assign in the following function. I pull out of the string with the .substr method with the start and length parameters. But once I do a substr, how do I get the result ultimately into a TCHAR that the function can return (and assign as one of its parameters):

TCHAR *Mid(TCHAR *dest, TCHAR *source, size_t start, size_t num)
{
wstring sSource(s);

// this line won't compile, unable to fix. How to get from subst to TCHAR?
dest = sSource.substr(start, num);  

return dest;
}

Thanks!

EDIT: Perhaps this?

{
wstring wSource(source);
wstring wTemp;
wTemp = wSource.substr(start, num);
_tcscpy(dest,wTemp.c_str());
return dest;
}
JeffR
  • 765
  • 2
  • 8
  • 23

0 Answers0