I am trying to create a file based on an integer value from a function, clearly does not work below , But lets you consider this:
getValue () -> 1. Create File () - & gt; {Ok, file} = file: open (getValue (), [write]), io: format (file, "test ~ n"), file: close (File). It should be easy, even with the lack of support for Erlangs wires, so I should have some clarity (as is the value of being new to something): If you want to open a file whose name is "1", then you integer_to_list / 1
to do this (because string is a list of integers for ASCII values of characters):
getValue () -> 1. .... {OK, file} = file: open (getValue ()), [write],
if you want based on filename getValue If the value is from / 0
, the same principle applies, but you create your file name by collecting several lists.
Comments
Post a Comment