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

  1. /*  c4dtok.c   Conversion Routines
  2.        (c)Copyright Sequiter Software Inc., 1987-1990.  All rights reserved.
  3. */
  4.  
  5. #include <string.h>
  6. #include "d4all.h"
  7. #include "p4misc.h"
  8.  
  9. /* Conversion from Double to format suitable for Index File Search
  10.  
  11.    Parameters:
  12.  
  13.    index_ref -    A reference to the Index File
  14.    doub_val  -    The key to search for.
  15.    key_val   -    A pointer to a character buffer to store the converted
  16.         result.  The buffer length should be greater than the
  17.         index file key length. (32 characters should do it !) .
  18. */
  19.  
  20. #ifdef CLIPPER
  21.    extern INDEX *v4index ;
  22. #endif
  23.  
  24. /* Not used for dBASE */
  25. c4dtok( int index_ref, double doub_val, char *key_val )
  26. {
  27. #ifdef CLIPPER
  28.       INDEX *index_ptr ;
  29.       char  *ptr ;
  30.       index_ptr =  v4index + index_ref ;
  31.       if ( index_ptr->key_len > 31 )   return -1 ;
  32.       ptr =  c4dtoa( doub_val, index_ptr->key_len, index_ptr->key_dec ) ;
  33.       memcpy( key_val, ptr, (size_t) index_ptr->key_len ) ;
  34.       c4clip( key_val, index_ptr->key_len ) ;
  35. #endif
  36.    return 0 ;
  37. }
  38.  
  39.  
  40.