TArray<uint8>转FString

void ARamaUDPReceiver::Recv(const FArrayReaderPtr& ArrayReaderPtr, const FIPv4Endpoint& EndPt)
{

int32 dataByteNum=ArrayReaderPtr->Num();
TArray<uint8> ReceivedData;
for (int i = 0; i < dataByteNum;i++)
{
uint8 tmp;
*ArrayReaderPtr << tmp;
ReceivedData.Add(tmp);
}
ReceivedData.Add('\0');
FString tryToString(reinterpret_cast<const char*>(ReceivedData.GetData()));
ReceivedData.RemoveSingle('\0');
ScreenMsg("Received from "+EndPt.ToString()+", Received bytes = ", dataByteNum, ", Reveived String ="+tryToString);
BPEvent_DataReceived(ReceivedData, tryToString);
}

posted @ 2017-04-07 17:42  酷熊  阅读(3309)  评论(0编辑  收藏  举报