disculpa no habia visto que decias usando FSEEK
agenda.edo=1 lo uso cuando day de altas, para especificar que el dato existe,, para poder hacer la baja logica..
si te interesa, mandame un correo, te puedo ayudar en archivos, ahi contactame, suerte
suponemos que tu estructura es :
struct reg
{
int pos,edo;
char nom[15],email[15],cel[15];
int pos_fis;
}
agenda;
void centra(int fila, char *texto)
{
gotoxy((80-strlen(texto))/2,fila);printf("%s",texto);
}
//CONSULTA
void consulta()
{
int aux,band=0;
clrscr();
FILE *archivo;
archivo=fopen("C:\\AGENDA_T.txt","rt");
if(archivo==NULL)
{
centra(24,"NO SE ENCONTRO EL ARCHIVO DE LECTURA");
}
else
{
centra(4,"CONSULTA TELEFONICA");
gotoxy(3,8);printf("Introduce el numero de registro: ");
scanf("%d",&aux);
agenda.pos_fis=(aux-1)*sizeof(agenda);
fseek(archivo,agenda.pos_fis,SEEK_SET);
//busca en el archivo
fread(&agenda,sizeof(agenda),1,archivo);
if(agenda.edo==1)
{
if(aux==agenda.pos)
{
band=1;
gotoxy(3,11);printf("Registro");
gotoxy(20,11);printf("Nombre");
gotoxy(32,11);printf("Email");
gotoxy(60,11);printf("Celular");
gotoxy(5,13);printf("%d",agenda.pos);
gotoxy(20,13);printf("%s",agenda.nom);
gotoxy(32,13);printf("%s",agenda.email);
gotoxy(60,13);printf("%s",agenda.cel);
}
}
if(!band)
{
centra(24,"NO SE ENCONTRO ESE REGISTRO");
}
}
fclose(archivo);
getch();
}