home *** CD-ROM | disk | FTP | other *** search
- /* btread */
- #include <stdio.h>
- #include <btextern.h>
-
- int btread (filhand, recno)
-
- /* read routine for btree system */
-
- int filhand, recno;
- {
- long offset;
- int i;
- char *cp;
-
- /* seek to correct byte in file */
- offset = recno * LBLEN;
-
- if (( i = fseek (btfilar[filhand].fdesc, offset, 0)) == -1)
- BTSETCOD (filhand, recno, 3); /* bad file seek */
-
- cp = (char *)btfilar[filhand].filbuf;
-
- if (!(i = fread (cp, 1, LBLEN, btfilar[filhand].fdesc)))
- BTSETCOD (filhand, recno, 1); /* bad file read */
- return (0);
- }
- /* end of btread */