How to create a config file to read dynamically
Ulf Wiger
etxuwig@REDACTED
Fri Mar 14 14:11:53 CET 2003
On Fri, 14 Mar 2003, Manjeet Singh wrote:
>I am working on a project, using erlang as the language, my
>requirement is that i want to create a config file which
>should be read at by the requesting task,at the run time
>with out stopping the system, how it is possible.
There are a number of possibilities, for example:
- Create a text file with one or more erlang terms, and
read it with file:consult(File). You can generate
such a file:
store_config(Data, File) ->
{ok,Fd} = file:open(File, [write]),
io:fwrite(Fd, "p.~n", [Data]),
file:close(Fd).
- Store configuration data in an ets table, and then call
ets:tab2file(EtsTable, File). The file can be read with
ets:file2tab(File), which re-creates the ets table.
- Store the configuration data using dets (disk-based hash
tables.)
- Use the mnesia database.
/Uffe
--
Ulf Wiger, Senior Specialist,
/ / / Architecture & Design of Carrier-Class Software
/ / / Strategic Product & System Management
/ / / Ericsson AB, Connectivity and Control Nodes
More information about the erlang-questions
mailing list