Source: https://cs.brynmawr.edu/Courses/cs246/spring2014/Slides/02_Formatted_IO.pdf