[erlang-questions] how: string stream?

Bengt Kleberg <>
Wed Oct 31 13:30:23 CET 2007


thank you for the link. i am not sure that is what i meant, though.

some time ago (1 year?) there was a repeat on this list of a 
string-as-io-object discussion that happened 3(?) years ago. i think you 
wrote that you had a ram-file module that could do this whereas i 
recommended my string_io. you convinced me that ram-file was a superset 
of string_io since it could do both files and strings.

i could be mistaken.


bengt
Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."


On 2007-10-31 10:34, Ulf Wiger (TN/EAB) wrote:
> Bengt Kleberg wrote:
>> greetings,
>>
>> there are at least two string streams that i know of. Ulf Wiger has 
>> one and I have one (string_io). his should be better.
> 
> I assume you mean this:
> 
> http://erlhive.svn.sourceforge.net/viewvc/erlhive/trunk/lib/erlhive/src/erlhive_ram_file_io_server.erl?revision=57&view=markup 
> 
> 
> used in this fasion:
> 
> http://erlhive.svn.sourceforge.net/viewvc/erlhive/trunk/lib/erlhive/src/erlhive_rewrite.erl?revision=64&view=markup 
> 
> 
>   121 parse_string(Str, Fname) ->
>   122     {ok, Fd} = open_ram_file(Fname),
>   123     file:write(Fd, Str),
>   124     file:position(Fd, 0),
>   125     case epp_dodger:parse(Fd) of
>   126     {ok, Tree} ->
>   127         close_ram_file(Fd),
>   128         Tree;
>   129     Error ->
>   130         close_ram_file(Fd),
>   131         erlang:error(Error)
>   132     end.
>   133
>   134
>   135 open_ram_file(Fname) ->
>   136     erlhive_ram_file_io_server:start(self(), Fname, [read,write]).
>   137
>   138 close_ram_file(Fd) ->
>   139     file:close(Fd).
> 
> It's not exactly a string stream, though.
> 
> BR,
> Ulf W



More information about the erlang-questions mailing list