这段代码会不会有错误?我只有这里用了指针了
procedure TMainForm.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
s,str:string;
i:integer;
begin
SetLength(S, BufferLength); //接收RS232的数据并显示Memo1上。
Move(Buffer^, PChar(S)^, BufferLength);
if (copy(s,1,1)='P') and (length(s)<19) and (length(s)>14) then
showdata(s)
else
begin
str:='F1;'; //发送远程控制
comm1.WriteCommData(pchar(str),length(str));
end;
end;