configurable fopen type
fix file_read and file_write