I have created a gen_server that should receive a tuple sent from the erlang shell and write it to a file along with the tuple size.
Example: the input received is {"A","B","C","D"}, and it should be written to a file as:
{"A","B","C","D"};4
and so on. The gen_server should also receive new inputs and store them in a txt file each on a new line.
I have tried but my code is not generating the required output. Assume I have written basic gen_server code with start_link, init, handle_call, handle_cast, handle_info, terminate and code_change.
Try this:
io_lib:format()is likeio:format()except instead of writing the string to the shell,io_lib:format()returns the string.In the shell: