procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
str: PChar;
begin
str := StrAlloc(100);
str := Buffer;
Memo1.Text := str;
end;
这段程序在另一个串口已经可以实现 memo1中的值是实时变化的 '=xxxxxxx'
现在要把收到的数据 逆序,即变成 xxxxxxx=
写了
procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
str: PChar;
i:integer;
str1: array of char;
begin
str := StrAlloc(bufferlength);
str := Buffer;
setlength(str1,bufferlength);
move(buffer^,str1[0],bufferlength);
for i:= low(str1) to high(str1) do
begin
str1:=str^;
str:=str+1;
end;
str:=buffer;
for i:=high(str1) to low(str1) do
begin
str^:=str1;
str:=str+1;
end;
Memo1.Text := str;
end;
显示的还是 =xxxxxxx 是什么问题?