Subversion Repositories Kolibri OS

Rev

Rev 300 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. #include <string.h>
  3. #include "kolibc.h"
  4.  
  5. int write_buffer(FILE *f);
  6. int fill_buff(FILE* f);
  7.  
  8. int fwrite(const void* src,size_t size,size_t count,FILE* f)
  9. {
  10.   size_t req;
  11.   size_t cnt;
  12.  
  13. //append mode unsupported
  14.  
  15. /************        
  16.   if(!((f->mode & FILE_OPEN_WRITE)|(f->mode & FILE_OPEN_PLUS)))
  17.     return EOF;
  18.        
  19.   req=count*size;
  20.   count=0;
  21.   while(req)
  22.   {
  23.     if(f->remain)
  24.     { cnt= req > f->remain ? f->remain : req;
  25.           memcpy(f->stream,src,cnt);
  26.           f->stream+=cnt;
  27.           f->strpos+=cnt;
  28.           f->remain-=cnt;
  29.           count+=cnt;
  30.           req-=cnt;
  31.         }
  32.         else
  33.         {
  34. //          if(!write_buffer(f))
  35. //            break;
  36.           f->filepos+=8192;
  37.           fill_buff(f);  
  38.         };
  39.   };
  40.   ***********/
  41.   return count;
  42.  
  43.   return count/size;
  44. };
  45.