Y
yongxuefeng
Unregistered / Unconfirmed
GUEST, unregistred user!
NMUDP1.ReportLevel := Status_Basic;
NMUDP1.RemoteHost := Edit1.Text;
NMUDP1.RemotePort := StrToInt(Edit2.Text);
TmpStr := Edit3.Text;
MyStream := TMemoryStream.Create;
try
MyStream.Write(Tmpstr[1], Length(Edit3.Text));
NMUDP1.SendStream(MyStream);
finally
MyStream.Free;
end;
以上是在编写Delphi里的udp程序是经常要用到的代码。请问问什么用:
mystream.write(tmpstr[1],length(edit3.text));
而不用:
mystream.write(tmpstr,length(edit3.text));
好象用
mystream.write(Pchar(tmpstr)^,length(edit3.text));
也行,请问问什么?有什么特别的要注意的吗?到底tmemorystream.write和read在底层
是怎么读和写的? 详细点!谢谢!
NMUDP1.RemoteHost := Edit1.Text;
NMUDP1.RemotePort := StrToInt(Edit2.Text);
TmpStr := Edit3.Text;
MyStream := TMemoryStream.Create;
try
MyStream.Write(Tmpstr[1], Length(Edit3.Text));
NMUDP1.SendStream(MyStream);
finally
MyStream.Free;
end;
以上是在编写Delphi里的udp程序是经常要用到的代码。请问问什么用:
mystream.write(tmpstr[1],length(edit3.text));
而不用:
mystream.write(tmpstr,length(edit3.text));
好象用
mystream.write(Pchar(tmpstr)^,length(edit3.text));
也行,请问问什么?有什么特别的要注意的吗?到底tmemorystream.write和read在底层
是怎么读和写的? 详细点!谢谢!