problem with gc?
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed May 27 00:56:13 PDT 2015
On Wednesday, 27 May 2015 at 05:48:13 UTC, zhmt wrote:
> I am writing a echoclient, as below:
>
> Ptr!Conn conn = connect("127.0.0.1",8881);
> ubyte[100] buf;
> for(int i=0; i<N; i++)
> {
> scope string str = format("%s",i);
> conn.write((cast(ubyte*)str.ptr)[0..str.length]);
> conn.read(buf[0..str.length]);
> n++;
> }
> conn.close();
You can use sformat
http://dlang.org/phobos/std_format.html#.sformat with your buffer.
More information about the Digitalmars-d-learn
mailing list