首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

将以上delphi代码用c++代码写出来

2013-01-07 
求助:将以下delphi代码用c++代码写出来class function TMxtTmProto.EncodeMsgData(const rawData: string)

求助:将以下delphi代码用c++代码写出来


class function TMxtTmProto.EncodeMsgData(const rawData: string): string;
var
  i:Integer;
  len:Integer;
begin
  Result := '';
  len := length(rawData);
  for i:=1 to len do
  begin
    if (Byte(rawData[i]) = $01) or (Byte(rawData[i]) = $04) or
      (Byte(rawData[i]) = $10) or (Byte(rawData[i]) = $11) or
      (Byte(rawData[i]) = $13) then
    begin
      Result := Result + Chr($10);
      Result := Result + Chr(Byte(rawData[i]) + $20);
    end
    else
      Result := Result + RawData[i];
  end;
end;

[解决办法]
这个函数的意思是
将字符串中的0x01  换成0x1021
            0x04  换成0x1024
            0x10  换成0x1030
            0x11  换成0x1031
            0x13  换成0x1033

热点排行