オフセットと長さが指定されたテキストへのポインターから wstring を取得したいと考えています。
typedef struct SPVTEXTFRAG
{
struct SPVTEXTFRAG *pNext;
SPVSTATE State;
LPCWSTR pTextStart;
ULONG ulTextLen;
ULONG ulTextSrcOffset;
} SPVTEXTFRAG;
pTextStart is a pointer to the beginning of the text associated with the fragment.
ulTextLen is the length of this text, in WCHARs.
ulTextSrcOffset is the offset of the first character of the text associated with the fragment.
Finally, State is the SAPI 5.0 XML state associated with this fragment.
See the XML TTS Tutorial for more details.
私は次のことを試しました:
wstring sText;
sText = nFragList->pTextStart;
sText = sText.substr(nFragList->ulTextSrcOffset,nFragList->ulTextLen);
しかし、それはまったく奇妙です。結果の wstring は間違った場所で切り落とされ、短すぎます。
LPCWSTR をより深く理解している人が、正しく行う方法を教えてくれませんか?
どうもありがとうございました!