changed bandgap accessing using open instead of fopen