home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SOURCE.EXE / F_NDXKEY.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  829 b   |  31 lines

  1. *****************************************************************
  2. FUNCTION NDXKEY (ndx_name, clip_ndx)
  3. *****************************************************************
  4.  
  5. * Reads key expression of an index file
  6.  
  7. * Copyright(c) 1991 -- James Occhiogrosso
  8.  
  9. LOCAL handle := key_start := 0, ret_string := ''
  10.  
  11. * Default to Clipper NTX extensions if not passed
  12. clip_ndx = IF(VALTYPE(clip_ndx) != 'L', .T., clip_ndx)
  13. key_start = IF(clip_ndx, 22, 24)
  14.  
  15. * Open index file in read only mode
  16. handle = FOPEN(ndx_name,0)
  17. IF FERROR() = 0
  18.  
  19.     * Move file pointer to beginning of key expression
  20.     FSEEK(handle, key_start, 0)
  21.  
  22.     * Read index key to first null byte or maximum length of 256
  23.     ret_string = FREADSTR(handle, 256)
  24.  
  25. ENDIF
  26.  
  27. * Close file and return index expression
  28. FCLOSE(handle)
  29. RETURN(ret_string)
  30.  
  31.