Passes the contents of a file to a function