I want to print integer values to a file. I am able to write string values to the file, but when I try to write an integer value it gives an error:
%this works fine
{ok, F}=file:open("bff.txt", [read,write]),
Val="howdy",
file:write(F,Val).
%this gets compiled, but results in error {error, badarg} while executing
{ok, F}=file:open("bff.txt", [read,write]),
Val=23424,
file:write(F,Val).
Any suggestions?
Actually I want to write a benchmarking code for a web server and I need to write all the values of times and no of requests to an output file, and then I’ll use it to plot graph with gnuplot.
Use
integer_to_list/1to convert integers to a list forfile:write/2.