/*--------------------------------------------------------------------
 * FICHERO:  BdtLeeRe.c
 * OBJETIVO: Definir la funcin Bdt_LeeRegistro()
 * AUTOR:    Pedro Reina
 * FECHA:    V.2.6.1995
 *------------------------------------------------------------------*/

/*--------------------------------------------------------------------
 * Ficheros de cabecera
 *------------------------------------------------------------------*/

#include "BaseDato.h"

/*--------------------------------------------------------------------
 * Definicin de funciones
 *------------------------------------------------------------------*/

/*--------------------------------------------------------------Olimpo
 * FUNCION:  Bdt_LeeRegistro()
 * OBJETIVO: Leer un registro desde el fichero a memoria
 * ENTRADAS: La base de datos y el nmero de registro
 * SALIDAS:  Lgica, que indicando si el registro se ha ledo.
 * NOTA:     Los registros se cuentan a partir de 0
 * EJEMPLO:  Bdt_LeeRegistro (Agenda,1)
 *------------------------------------------------------------------*/
logico Bdt_LeeRegistro (Base, Numero)
basedato Base;
entero   Numero;
  {
  logico Respuesta = NO;

  if ( Numero >= 0 && Numero < Bdt_TotalRegistro(Base) )
    {
    Fch_Coloca (Bdt_Fichero(Base), Bdt_ComienzoRegistro(Base) +
                                   Bdt_LongitudRegistro(Base) * Numero );
    if ( Fch_LeeOcteto (Bdt_Fichero(Base), Bdt_InfoActual(Base),
                        Bdt_LongitudRegistro(Base)) )
      {
      Respuesta = SI;
      Bdt_PonActual (Base, Numero);
      }
    }

  return ( Respuesta );
  }