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

  1.  
  2. /* d4lseek.c   (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved. */
  3.  
  4. #include "p4misc.h"
  5. #include "d4base.h"
  6. #include "u4error.h"
  7.  
  8. #ifndef UNIX
  9. #include <io.h>
  10. #endif
  11.  
  12. extern int  v4cur_base ;
  13. extern BASE  *v4base ;
  14.  
  15. int  d4lseek( long rec_num )
  16. {
  17.    BASE  *base_ptr ;
  18.    long   pos ;
  19.  
  20.    base_ptr =  v4base + v4cur_base ;
  21.  
  22.    pos  =   base_ptr->header_len+ (rec_num-1)* base_ptr->buffer_len ;
  23.    if ( lseek( base_ptr->file_hand, pos, 0 ) != pos )
  24.    {
  25.       u4error( E_LSEEK, base_ptr->name, (char *) 0 ) ;
  26.       return -1 ;
  27.    }
  28.  
  29.    return 0 ;
  30. }
  31.