Read a file and put the data into dynamicaly created memory