如何将Buffer写入流中? Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiNetwork/html/delphi_20061119104014300.html
var
buffer:array [0..100] of char;
begin
mymemory:tmemorystream.create;
mymemory.position:=0;
//现在如何将buffer写入流中?
错了 我想问的是如何将流写入buffer中
var
buffer:array [0..100] of char;
begin
mymemory:tmemorystream.create;
mymemory.position:=0;
memo1.lines.savetostream(mymemory);
//然后如何将mymemory写入Buffer中?请高手不吝指教
我用的是idudp 这个控件没有sendstream方法 只有sendbuffer
var
buffer: array [0..100] of Char;
mymemory: TMemoryStream;
begin
mymemory := TMemoryStream.Create;
Memo1.Lines.SaveToStream(mymemory);
mymemory.Position := 0;
mymemory.Read(buffer, SizeOf(buffer));
{ TODO : 操作buffer }
mymemory.Free;
end;
var
S: string;
begin
IdUDPClient1.Send(Memo1.Text);
//or
S := Memo1.Text;
if S <> '' then IdUDPClient1.SendBuffer(S[1], Length(S));
end;
同意上楼