この種のコードを使用して、Web サービスからテキスト文字列を RBuf8 にダウンロードしています (動作します..)
void CMyApp::BodyReceivedL( const TDesC8& data ) {
int newLength = iTextBuffer.Length() + data.Length();
if (iTextBuffer.MaxLength() < newLength)
{
iTextBuffer.ReAllocL(newLength);
}
iTextBuffer.Append(data);
}
次に、RBuf8をラベルなどに表示できるchar *文字列に変換したい..またはデバッグの目的で、
RDebug::Printf("downloading text %S", charstring);
明確にするために編集..
私の変換関数は次のようになります..
void CMyApp::DownloadCompleteL() { { RBuf16 buf; buf.CreateL(iTextBuffer.Length()); buf.Copy(iTextBuffer);
RDebug::Printf("downloaded text %S", buf);
iTextBuffer.SetLength(0);
iTextBuffer.ReAlloc(0);
}
しかし、これでもクラッシュが発生します。S60 3rd Edition FP2 v1.1 を使用しています