ComPort-Library
ComPort-Library copied to clipboard
using String Buffer Y lost data after #0 character
String converting lost data after #0 symbol You can't get #0 from port....
property Buffer: string read FBuffer write FBuffer; <<<<<<<<<<<< Here!
procedure TComDataPacket.RxBuf(Sender: TObject; const Buffer; Count: Integer); var sa:AnsiString; Str: string; i:Integer; begin SetLength(Str, Count); SetLength(Sa, Count); Move(Buffer, Sa[1], Count); {$IFDEF Unicode} if Length(sa)>0 then for i := 1 to Length(sa) do Str[i] := char(Byte(sa[i])); {$ELSE} Str := sa; {$ENDIF} <<<<<<<<<<<< Here! AddData(Str); end;
// add custom data to packet buffer procedure TComDataPacket.AddData(const Str: string); begin if ValidStop then begin Buffer := Buffer + Str; <<<<<<<<<<<< Here! HandleBuffer; end else DoPacket(Str); end;
Yep it has string everywhere instead of AnsiString And what the ... this {IFDEF Unicode} section???