Skip to content

Instantly share code, notes, and snippets.

@hntrmrrs
Created July 15, 2009 10:49
Show Gist options
  • Save hntrmrrs/147640 to your computer and use it in GitHub Desktop.
Save hntrmrrs/147640 to your computer and use it in GitHub Desktop.
-spec(read_input_string/2 :: (integer(), ewgi_context()) -> string()).
read_input_string(Size, Ctx) when is_integer(Size) ->
R = read_input(Ctx),
Iol = R(read_input_string_cb([]), Size),
Bin = iolist_to_binary(Iol),
binary_to_list(Bin).
read_input_string_cb(Acc) ->
F = fun(eof) ->
lists:reverse(Acc);
({data, B}) ->
read_input_string_cb([B|Acc])
end,
F.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment