Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread Sven Barth
Am 21.07.2014 10:29 schrieb "LacaK" : > > Hi, > When I work with f.e. TFileStream I need often write string into stream. > Now I use: > Stream1.WriteBuffer(s[1], length(s)); > > I think, that for convenience it will be useful having something like: > procedure TStream.WriteString(const s: string);

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread LacaK
Sven Barth wrote / napísal(a): Am 21.07.2014 10:29 schrieb "LacaK" >: > > Hi, > When I work with f.e. TFileStream I need often write string into stream. > Now I use: > Stream1.WriteBuffer(s[1], length(s)); > > I think, that for convenience it will be useful having some

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread Michael Van Canneyt
On Mon, 21 Jul 2014, LacaK wrote: Sven Barth  wrote / napísal(a): Am 21.07.2014 10:29 schrieb "LacaK" : > > Hi, > When I work with f.e. TFileStream I need often write string into stream. > Now I use: >  Stream1.WriteBuffer(s[1], length(s)); > >

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > > Nothing stops you though from writing a class helper that adds a > > WriteString method to TStream. > > > > Yes, I can create also own descendant etc. ... but I am asking for general > > solution, which will be useful for all. > > Sur

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread LacaK
Marco van de Voort wrote / napísal(a): In our previous episode, Michael Van Canneyt said: Nothing stops you though from writing a class helper that adds a WriteString method to TStream. Yes, I can create also own descendant etc. ... but I am asking for general solution, which will b

Re: [fpc-devel] Method for write string into TStream

2014-07-22 Thread LacaK
Recap: Way 1: Introduce new method(s), leave Write/ReadAnsiString as is. 1.1 procedure WriteRawString(const s: string); function ReadRawString(Len: integer) 1.2 (ready for future when string will be UnicodeString) procedure WriteString(const s: string); function ReadString(Len: integer) 1.3

Re: [fpc-devel] Method for write string into TStream

2014-07-22 Thread tha...@thaddy.com
You can always use KOL for that ;) But anyway: we implemented that at the cost of read-back speed and looking for zero termination, which is flawed anyway for object pascal strings, since it can contain zero's. It can be done through RTTI with my usual complaints about that sort of shit. A (a