[erlang-questions] compile module from string, containing macro definitions

Richard Carlsson richardc@REDACTED
Wed Mar 14 22:16:53 CET 2007


Bengt Kleberg wrote:
> inspired by string ports i have written a string_io module that allows 
> you to
> 
> {ok, IO} = string_io:open( "a number: 10", [read, write]),
> "a" = io:get_chars( IO, '', 1),
> io:fwrite(IO, "-" ),
> 10 = io:fread( IO, '', "number: ~d" ),
> string_io:close( IO ).

I wrote this (attached) module a few years back, and then more or less
forgot about it again. It can work as a pipe, or just read from a
string. It would be nice if something like it (or your own version)
would make its way into the standard library. The code is not terribly
well tested but I think it worked. Feel free to reuse the best parts.

    /Richard
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: iostream.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070314/6177bcf5/attachment.ksh>


More information about the erlang-questions mailing list