我要实现的是把接收到的数据一字不变的完全转成string。
例如收到303132,就转成'303132',而不是'012'三个字符组成的string。
写法还是有问题,代码如下:
      AComm.Output:=mbuffer;                  //mbuffer是一个array of byte
      sleep(350);
      setLength(mget,AComm.InBufferCount);
      mget:=AComm.Input;
      str:='';                                 //str是一个string
      for i:=1 to High(mget) do
        str:=str+intToHex(mget[i-1],2);   
      result:=str;   
上面这样就会出现Invalid argument错误,为什么???
若写成如下:
      AComm.Output:=mbuffer;                  //mbuffer是一个array of byte,发送没问题
      sleep(350);
      str:=AComm.Input;   
      result:=str;
结果收到的就是由三个字符组成的string,即'012',而不是我想要的'303132'。
正确的写法应该是怎么样的???很急!!!

解决方案 »

  1.   

    上面的mget也是一个array of byte.
    我觉得好象用byte数组接收会出现Invalid argument错误,用string接收就没有问题。但是用了string接收会把16进制数都转成字符的。到底应该怎么做啊???急死了!!!
    看看书上写的都是用byte数组接收和发送的。请高手指点!!!
      

  2.   

    IPC addresses identify both incoming connection requests from applications on the
    same node as the listener and information sent or registered by a database
    dispatcher. If the IPS addresses identify connection requests from the same node,
    the KEY value is equal to the service name of the database. If the addresses
    identify a database dispatcher, the KEY value is equal to the database system
    identifier (SID). If the service name is the same as the SID, only one IPC address is
    needed.