home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR41 / CBASE11.ZIP / BGETB.C < prev    next >
C/C++ Source or Header  |  1993-01-01  |  2KB  |  63 lines

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