c:m() output to variable

Luke Gorrie <>
Tue Sep 23 14:57:45 CEST 2003


"Inswitch Solutions - Erlang Evaluation" <> writes:

> Does anyone know if there is a way to store the output of c:m() in a variable?
> L = c:m().

If bring up c.erl, the definition is:

  m() ->
      mformat("Module", "File"),
      foreach(fun ({Mod,File}) -> mformat(Mod, File) end, sort(code:all_loaded())).

  mformat(A1, A2) ->
      format("~-20s  ~s\n", [A1,A2]).

So code:all_loaded() is most of what you want.

-Luke




More information about the erlang-questions mailing list