<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a trivial task: read a null-terminated string from a stream.<br>
The size of the string has no predefined limit. How do I do that<br>
in Racket? I need some resizable thing to store characters,<br>
like vector<char> in C++ or StringBuilder in C# or Java.<br>
Does Racket have one?<br>
<br></blockquote><div><br></div><div>Hi Dmitry,</div><div><br></div><div>You can use an output-string-port for this purpose. Use the "open-output-string" to create an output port, and write to it using the standard port-writing functions. Finally, use "get-output-string" to get the final, concatenated result.</div>
<div><br></div><div>Example:</div><div><br></div><div><div>> (define op (open-output-string))</div><div>> (display "hello" op)</div><div>> (display "world" op)</div><div>> (get-output-string op)</div>
<div>"helloworld"</div></div><div><br></div><div><br></div><div>For more information, see:</div><div><br></div><div> <a href="http://docs.racket-lang.org/guide/ports.html">http://docs.racket-lang.org/guide/ports.html</a></div>
<div><br></div><div><br></div></div>