home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / DOOG / CBASE09.ZIP / BLKIO10.ZIP / BGETB.C < prev    next >
Text File  |  1989-08-30  |  1KB  |  49 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "bgetb.c    1.1 - 89/07/03" */
  5.  
  6. #include <errno.h>
  7. #include "blkio_.h"
  8.  
  9. /*man---------------------------------------------------------------------------
  10. NAME
  11.      bgetb - get a block from a block file
  12.  
  13. SYNOPSIS
  14.      #include <blkio.h>
  15.  
  16.      int bgetb(bp, bn, buf)
  17.      BLKFILE *bp;
  18.      bpos_t bn;
  19.      void *buf;
  20.  
  21. DESCRIPTION
  22.      The bgetb function reads block number bn from the block file associated
  23.      with BLKFILE pointer bp.  buf must point to a storage area at least as
  24.      large as the block size for bp.  Block numbering starts at 1.
  25.  
  26.      bgetb will fail if one or more of the following is true:
  27.  
  28.      [EINVAL]       bp is not a valid BLKFILE pointer.
  29.      [EINVAL]       bn is less than 1.
  30.      [EINVAL]       buf is the NULL pointer.
  31.      [BEEOF]        There are not bn blocks in the file.
  32.      [BENOPEN]      bp is not open for reading.
  33.  
  34. SEE ALSO
  35.      bgetbf, bgeth, bputb.
  36.  
  37. DIAGNOSTICS
  38.      Upon successful completion, a value of 0 is returned.  Otherwise, a
  39.      value of -1 is returned, and errno set to indicate the error.
  40.  
  41. ------------------------------------------------------------------------------*/
  42. int bgetb(bp, bn, buf)
  43. BLKFILE * bp;
  44. bpos_t    bn;
  45. void *    buf;
  46. {
  47.     return bgetbf(bp, bn, (size_t)0, buf, bp->blksize);
  48. }
  49.