Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can i add text to rawtobytedata ?
#6
(09-30-2019, 02:48 PM)Madammar Wrote: which came to my mind i have to split out the Audio1 to a string variable and do the checking

Indy has BytesToString() and BytesToStringRaw() functions, which take an optional index and length as input, eg:

Code:
if BytesToString(bytes, 0, 6) = 'Audio1' then
begin
  // use bytes[6]..bytes[High(bytes)] as needed...
end;

Or, you could simply use the RTL's CompareMem() function, eg:

Code:
if (Length(bytes) >= 6) and CompareMem(PByte(bytes), PAnsiChar('Audio1'), 6) = 0 then
begin
  // use bytes[6]..bytes[High(bytes)] as needed...
end;

Reply


Messages In This Thread
can i add text to rawtobytedata ? - by Madammar - 09-19-2019, 09:13 AM
RE: can i add text to rawtobytedata ? - by rlebeau - 09-30-2019, 10:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)