Re: Reading a string in binary mode

2014-03-03 Thread Christof Schardt
"bearophile" schrieb im Newsbeitrag news:qqcdemwimcylaizjy...@forum.dlang.org... > Christof Schardt: > >> By "trickery" I meant having to know about things like >> "import std.exception : assumeUnique" for this basic kind of task. > > Your function has signature (you use "ref" instead of "in" or

Re: Reading a string in binary mode

2014-03-03 Thread bearophile
Christof Schardt: By "trickery" I meant having to know about things like "import std.exception : assumeUnique" for this basic kind of task. Your function has signature (you use "ref" instead of "in" or "out" because it performs read/write): void rw(ref string x) A string is a immutable(ch

Re: Reading a string in binary mode

2014-03-03 Thread Christof Schardt
"John Colvin" schrieb im Newsbeitrag news:zjsykclxreagfhqsq...@forum.dlang.org... > On Monday, 3 March 2014 at 22:22:06 UTC, Christof Schardt wrote: >> "John Colvin" schrieb im Newsbeitrag >> news:dyfkblqonigrtmkwt...@forum.dlang.org... >>> On Monday, 3 March 2014 at 21:44:16 UTC, Christof Schar

Re: Reading a string in binary mode

2014-03-03 Thread John Colvin
On Monday, 3 March 2014 at 22:22:06 UTC, Christof Schardt wrote: "John Colvin" schrieb im Newsbeitrag news:dyfkblqonigrtmkwt...@forum.dlang.org... On Monday, 3 March 2014 at 21:44:16 UTC, Christof Schardt wrote: I'm evaluating D and try to write a binary io class. I got stuck with strings:

Re: Reading a string in binary mode

2014-03-03 Thread Ali Çehreli
On 03/03/2014 02:25 PM, Christof Schardt wrote: > Thanks, Ali, this works. Yay! :) > book be equipped with a TOC and an index? Yes, all of that will happen after I get back to working on the book and its ever increasing list of to-dos. :) Ali

Re: Reading a string in binary mode

2014-03-03 Thread Christof Schardt
"Ali Çehreli" schrieb im Newsbeitrag news:lf2ude$1njf$1...@digitalmars.com... > On 03/03/2014 01:44 PM, Christof Schardt wrote:> I'm evaluating D and try > to write a binary io class. > > I got stuck with strings: > > > > void rw(ref string x) > > { > > if(_isWriting) > >

Re: Reading a string in binary mode

2014-03-03 Thread Christof Schardt
"John Colvin" schrieb im Newsbeitrag news:dyfkblqonigrtmkwt...@forum.dlang.org... > On Monday, 3 March 2014 at 21:44:16 UTC, Christof Schardt wrote: >> I'm evaluating D and try to write a binary io class. >> I got stuck with strings: >> >> void rw(ref string x) >> { >> if(_isWriti

Re: Reading a string in binary mode

2014-03-03 Thread Ali Çehreli
On 03/03/2014 01:44 PM, Christof Schardt wrote:> I'm evaluating D and try to write a binary io class. > I got stuck with strings: > > void rw(ref string x) > { > if(_isWriting) > { > int size = x.length; > _f.rawWrite((&size)[0..1]); >

Re: Reading a string in binary mode

2014-03-03 Thread John Colvin
On Monday, 3 March 2014 at 21:44:16 UTC, Christof Schardt wrote: I'm evaluating D and try to write a binary io class. I got stuck with strings: void rw(ref string x) { if(_isWriting) { int size = x.length; _f.rawWrite((&size)[0..1]); _f

Reading a string in binary mode

2014-03-03 Thread Christof Schardt
I'm evaluating D and try to write a binary io class. I got stuck with strings: void rw(ref string x) { if(_isWriting) { int size = x.length; _f.rawWrite((&size)[0..1]); _f.rawWrite(x); } else { int size