home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / SOURCE / D4SEEK_D.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-22  |  1.2 KB  |  64 lines

  1.  
  2. /*  d4seek_d.c   (c)Copyright Sequiter Software Inc., 1987-1990.  All rights reserved.
  3.  
  4.     Locates and reads the record.
  5.  
  6.     Returns
  7.  
  8.        0 Success
  9.        1 Inexact Find
  10.        2 On record after
  11.        3 EOF
  12.       -1 Error
  13. */
  14.  
  15. #include "d4all.h"
  16. #include "u4error.h"
  17.  
  18. extern  INDEX *v4index ;
  19.  
  20.  
  21. int  d4seek_double( double d )
  22. {
  23.    INDEX *index_ptr ;
  24.    int    index_ref ;
  25.  
  26.    if ( (index_ref = i4seek_ref()) < 0 )
  27.    {
  28.       u4error( E_NO_INDEX, d4name(), (char *) 0 ) ;
  29.       return( -1 ) ;
  30.    }
  31.  
  32.    index_ptr=  v4index+ index_ref ;
  33.  
  34.    #ifdef CLIPPER
  35.    {
  36.       char  seek_buf[32] ;
  37.  
  38.       if ( index_ptr->i_type == 'N' ||  index_ptr->i_type == 'F' ) 
  39.       {
  40.      c4dtok( index_ref, d, seek_buf ) ;
  41.      return( d4seek_key( index_ref, seek_buf) ) ;
  42.       }
  43.       else
  44.       {
  45.          if ( index_ptr->i_type == 'D' )
  46.          {
  47.             c4dt_str( seek_buf, &d ) ;
  48.         return( d4seek_key( index_ref, seek_buf) ) ;
  49.          }
  50.          else
  51.             return 3 ;
  52.       }
  53.    }
  54.    #else
  55.       if ( index_ptr->i_type == 'C' )
  56.      return 3 ;
  57.       else
  58.      return( d4seek_key( index_ref, (char *) &d) ) ;
  59.    #endif
  60. }
  61.  
  62.  
  63.  
  64.