Преобразовать строку в BSTR - PullRequest
0 голосов
/ 24 октября 2019

Из следующей функции я использую путь. Теперь я генерирую, скажем, список имен, разделенных новой строкой

 func(BSTR * path)
 {

  // From path paramter client sent, I use the path. 

   //Now I generate some lets say list of names separated by newline

   string output = "Bob\n Rob \n Lilly \n";


   // Now client wants the path to be modified with the output

  // So i did the following 

SysFreeString(*path);
*path= SysAllocStringByteLen(output.c_str(), output.size());

  }

Верны ли последние две строки. Как-то тестирование не кажется нормальным!

...