File size check in fread, and internal method error reporting in fopen.
Added read mode check.
Added the fwrite method.