read_idx function

Read an IDX file