add ci.c; change open/read/close to fopen/fread/fclose;