static int find_vector(GapIO *io, char *V) { char buf[128]; /* this should be more than enough */ int i; GVectors t; for(i=0;i<io->db.Nvectors;i++) { /* read vector record */ GT_Read(io,arr(GCardinal,io->vectors,i),&t,sizeof(t),GT_Vectors); /* read vector name */ TextRead(io, t.name, buf, sizeof(buf)); if (strcmp(buf,V)==0) return i+1; } return 0; }
static int find_clone(GapIO *io, char *CN) { char buf[128]; /* this should be more than enough */ int i; GClones c; for(i=0;i<io->db.Nclones;i++) { /* read clone record */ GT_Read(io,arr(GCardinal,io->clones,i),&c,sizeof(c),GT_Clones); /* read clone name */ TextRead(io, c.name, buf, sizeof(buf)); if (strcmp(buf,CN)==0) return i+1; } return 0; }
int main(void) { #if 1 if(TextRead(file_path, &playHead) < 0) { printf("deal data fail\n"); return -1; } #else if(GetPlayList(file_path, &playHead) < 0) { printf("get play list fail\n"); return -1; } #endif //free(data); printf("\nget file end here\n"); return 0; }