<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sven Barth  wrote / napísal(a):
<blockquote
 cite="mid:CAFMUeB9nbUVQB537LyOzW6socybu6o-PHckX1GedyhhkzZkfuA@mail.gmail.com"
 type="cite">
  <p>Am 21.07.2014 10:29 schrieb "LacaK" <<a moz-do-not-send="true"
 href="mailto:lacak@zoznam.sk">lacak@zoznam.sk</a>>:<br>
><br>
> Hi,<br>
> When I work with f.e. TFileStream I need often write string into
stream.<br>
> Now I use:<br>
>  Stream1.WriteBuffer(s[1], length(s));<br>
><br>
> I think, that for convenience it will be useful having something
like:<br>
> procedure TStream.WriteString(const s: string);<br>
>  begin<br>
>    WriteBuffer(s[1], length(s)*sizeof(char);<br>
>  end;<br>
><br>
> In FPC we now have for user convenience also WriteByte, WriteWord,
WriteQWord (which all calls WriteBuffer)<br>
> and Delphi has lot of overloaded WriteData (but none of them takes
as parameter string):<br>
>  <a moz-do-not-send="true"
 href="http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TStream.WriteData">http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TStream.WriteData</a><br>
><br>
> Do you think, that something similar can be added also in FPC ?</p>
  <p>There is already a WriteAnsiString ( <a moz-do-not-send="true"
 href="http://www.freepascal.org/docs-html/rtl/classes/tstream.writeansistring.html">http://www.freepascal.org/docs-html/rtl/classes/tstream.writeansistring.html</a>
) with the difference that it also writes out the length.</p>
</blockquote>
Yes I know, and I do not want write length only content of string<br>
<br>
<blockquote
 cite="mid:CAFMUeB9nbUVQB537LyOzW6socybu6o-PHckX1GedyhhkzZkfuA@mail.gmail.com"
 type="cite">
  <p> Adding an additional overload (especially with a name like
WriteString) would IMHO be confusing because of this.</p>
</blockquote>
Yes without looking into documentation at first look it can by
confusable<br>
(what about WriteRawString then) ?<br>
<br>
<blockquote
 cite="mid:CAFMUeB9nbUVQB537LyOzW6socybu6o-PHckX1GedyhhkzZkfuA@mail.gmail.com"
 type="cite">
  <p>Nothing stops you though from writing a class helper that adds a
WriteString method to TStream.</p>
</blockquote>
Yes, I can create also own descendant etc. ... but I am asking for
general solution, which will be useful for all.<br>
<br>
Thanks<br>
-Laco.<br>
<br>
</body>
</html>