1.6 KiB
1.6 KiB
Hints
1. General
- Read about files in the official Getting Started guide.
- Read about files on joyofelixir.com.
- Take a look at the documentation of the
File
module.
1. Read email addresses from a file
- There is a built-in function for reading the contents of a file all at once.
2. Open a log file for writing
- There is a built-in function for opening a file.
- The second argument of that function is a list of modes which allows specifying that the file should be opened for writing.
3. Log a sent email
- Functions for reading and writing to a file opened with
File.open!/1
can be found in theIO
module. - There is a built-in function for writing a string to a file, followed by a newline.
4. Close the log file
- There is a built-in function for closing a file.
5. Send the newsletter
- All the necessary operations on files were already implemented in the previous steps.
- Before writing to a file, the file must be opened.
- After all write operations to a file finished, the file should be closed.