home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / fwrite.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  1.6 KB  |  83 lines

  1. /*
  2.     (C) 1995 AROS - The Amiga Replacement OS
  3.     $Id: fwrite.c,v 1.2 1997/01/27 00:36:21 ldp Exp $
  4.     $Log: fwrite.c,v $
  5.     Revision 1.2  1997/01/27 00:36:21  ldp
  6.     Polish
  7.  
  8.     Revision 1.1  1996/11/25 15:50:57  aros
  9.     Two new functions
  10.  
  11.     Desc:
  12.     Lang: english
  13. */
  14. #include "dos_intern.h"
  15.  
  16. /*****************************************************************************
  17.  
  18.     NAME */
  19. #include <proto/dos.h>
  20.  
  21.     AROS_LH4(LONG, FWrite,
  22.  
  23. /*  SYNOPSIS */
  24.     AROS_LHA(BPTR , fh, D1),
  25.     AROS_LHA(APTR , block, D2),
  26.     AROS_LHA(ULONG, blocklen, D3),
  27.     AROS_LHA(ULONG, number, D4),
  28.  
  29. /*  LOCATION */
  30.     struct DosLibrary *, DOSBase, 55, Dos)
  31.  
  32. /*  FUNCTION
  33.     Write a number of blocks to a file.
  34.  
  35.     INPUTS
  36.     fh - Write to this file
  37.     block - The data begins here
  38.     blocklen - This is the size of a single block
  39.     number - The number of blocks
  40.  
  41.     RESULT
  42.     The number of blocks written to the file or EOF on error. IoErr()
  43.     gives additional information in case of an error.
  44.  
  45.     NOTES
  46.  
  47.     EXAMPLE
  48.  
  49.     BUGS
  50.  
  51.     SEE ALSO
  52.     Open(), FRead(), FPutc(), Close()
  53.  
  54.     INTERNALS
  55.  
  56.     HISTORY
  57.     29-10-95    digulla automatically created from
  58.                 dos_lib.fd and clib/dos_protos.h
  59.  
  60. *****************************************************************************/
  61. {
  62.     AROS_LIBFUNC_INIT
  63.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  64.     ULONG   written;
  65.     ULONG   len;
  66.     UBYTE * ptr;
  67.  
  68.     ptr = block;
  69.     len = 0;
  70.  
  71.     for (written=0; written<number; written++)
  72.     {
  73.     for (len=blocklen; len--; )
  74.     {
  75.         if (FPutC (fh,*ptr++) < 0)
  76.         return EOF;
  77.     }
  78.     }
  79.  
  80.     return written;
  81.     AROS_LIBFUNC_EXIT
  82. } /* FWrite */
  83.