Source: http://tuttle.merc.iastate.edu/ee285/topics/file_i-o.pdf