use fread() instead read()