int compare_filenames(char* data, char* filename){
//note: we only have 31 directory/file entries within a block
int i;
int offset;
//printf("argument %s\n", filename);
for(i = 0; i < BLOCK_SIZE; i+=16){
if(strcmp(filename, &data[i])){
offset = i + 12;
return data[i+12];// double check here
}
}
return ERR_FILE_NOT_FOUND; //didn't find it within
}
对于某些共振,即使第一个元素正好在开头,strcmp 也会经历两次循环迭代