home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / vbcc / machines / amigappc / libsrc / stdio / fwrite.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-24  |  1020 b   |  37 lines

  1. /*
  2. ** vbcc-Amiga-PowerPC version of fwrite.c
  3. **
  4. ** v0.1 04.10.97 phx
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <powerup/gcclib/powerup_protos.h>
  9.  
  10. size_t fwrite(void *ptr,size_t size,size_t nmemb,FILE *f)
  11. {
  12.     size_t total=size*nmemb;char *p=ptr;long result;
  13.     if(!f||!total) return(0);
  14.     if((f->flags&(_WRITEABLE|_READ|_ERR|_EOF))!=_WRITEABLE) return(0);
  15.     f->flags|=_WRITE;
  16.     /*  einfache (ungepufferte) Implementation  */
  17.     fflush(f);
  18.     result=PPCWrite((BPTR)f->filehandle,p,total);
  19.     if(result==-1){f->flags|=_ERR;return(0);}
  20.     return(result/size);
  21.  
  22. /*    if(f->count){
  23.         if(total<=f->count){
  24.             memcpy(f->pointer,p,total);
  25.             f->pointer+=total;f->count-=total;
  26.             return(total);
  27.         }else{
  28.             memcpy(f->pointer,p,f->count);
  29.             total-=f->count;p+=f->count;
  30.             f->count=0;
  31.         }
  32.     }
  33.     result=PPCRead((BPTR)f->filehandle,p,total);
  34.     if(result==-1){f->flags|=_ERR;return((p-(char *)ptr)/size);}
  35.     return((p+total-(char *)ptr)/size);*/
  36. }
  37.