Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Candidato *consultarand(char *nome, Hash tab, long long int inscr)
- {
- Candidato *aux, *c;
- int endreg;
- size = sizeof(Candidato);
- int h = hashf(inscr);
- for (aux = tab[h] ; aux != NULL ; aux = aux->prox){ //percorre tabela hash para saber se a inscrição existe
- if (tab[h] == NULL){
- printf ("\nRegistro inexistente \n");
- return NULL;
- }
- if (aux.inscr == inscr){
- break; //inscrição existe na tabela
- }else{
- return NULL;
- }
- }
- FILE *arq = fopen (*nome, "rb");
- endreg = (h - 1) * size; //calcula o endereço do registro
- fseek (arq, size, endreg); //desloca o cursos para o endereço calculado
- fread (&c, size, 1, arq); //le a estrutura candidato presente naquele endereço
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement