我收到一个字符串,它'{'#0'S'#0'a'#0'm'#0'p'#0'l'#0'e'#0'-'#0'M'#0'e'#0's'#0's'#0'a'#0'g'#0'e'#0'}'#0在调试器中显示。
OutputDebugString我需要在调试输出 ( )中打印出来。
当我运行时OutputDebugString(PChar(mymsg)),只显示接收到的字符串的第一个字符(可能是因为#0字符串结束标记)。
如何将该字符串转换为OutputDebugString可以使用的东西?
更新 1:这是代码。我想打印变量的内容RxBufStr。
procedure ReceivingThread.OnExecute(AContext : TIdContext);
var
RxBufStr: String;
begin
with AContext.Connection.IOHandler do
begin
CheckForDataOnSource(10);
if not InputBufferIsEmpty then
begin
RxBufStr := InputBuffer.Extract();
end;
end;
end;