home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / btrees / btwrit.c < prev   
Encoding:
C/C++ Source or Header  |  1984-12-14  |  529 b   |  23 lines

  1. /*    btwrit    */
  2. #include <stdio.h>
  3. #include <btextern.h>
  4. int btwrit (filhand, recno)
  5.     int filhand, recno;
  6. {
  7.     long offset;
  8.     int i;
  9.     char *cp;
  10.  
  11. /*    seek to correct byte in record        */
  12.     offset = recno * LBLEN;
  13.     if (( i = fseek (btfilar[filhand].fdesc, offset, 0)) == -1)
  14.         BTSETCOD (filhand, recno, 3);    /* bad file seek */
  15.  
  16.     cp = (char *)btfilar[filhand].filbuf;
  17.  
  18.     if (!( i = fwrite (cp, 1, LBLEN, btfilar[filhand].fdesc)))
  19.         BTSETCOD (filhand, recno, 2);    /* bad write */
  20.     return (0);
  21. }    
  22. /*    end of btwrit    */
  23.