Use strncpy instead of strcpy.
remove unused variable.
add null check
add return value check of fseek