firemonkey-fm3

How to convert strings to array of byte and back

谁说胖子不能爱 提交于 2019-11-29 18:01:55
问题 4I must write strings to a binary MIDI file. The standard requires one to know the length of the string in bytes. As I want to write for mobile as well I cannot use AnsiString, which was a good way to ensure that the string was a one-byte string. That simplified things. I tested the following code: TByte = array of Byte; function TForm3.convertSB (arg: string): TByte; var i: Int32; begin Label1.Text := (SizeOf (Char)); for i := Low (arg) to High (arg) do begin label1.Text := label1.Text + ' '