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

  1.  
  2. /*  d4seek.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. int  d4seek( void *search_string )
  21. {
  22.    int    index_ref ;
  23.  
  24.    if ( (index_ref = i4seek_ref()) < 0 )
  25.    {
  26.       u4error( E_NO_INDEX, d4name(), (char *) 0 ) ;
  27.       return( -1 ) ;
  28.    }
  29.  
  30.    #ifdef CLIPPER
  31.       if ( v4index[index_ref].i_type == 'N' ||  v4index[index_ref].i_type == 'F' ) 
  32.       {
  33.      char  seek_buf[32] ;
  34.      c4dtok( index_ref, *((double *)search_string), seek_buf ) ;
  35.      return( d4seek_key( index_ref, seek_buf) ) ;
  36.       }
  37.       else
  38.      return( d4seek_key( index_ref, search_string )) ;
  39.    #else
  40.       return( d4seek_key( index_ref, (char *) search_string) ) ;
  41.    #endif
  42. }
  43.  
  44.  
  45.