Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - fwrite http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   fwrite

   Usage
   #include <stdio.h>

   size_t fwrite(const void *buffer,size_t sizelem, size_t n,FILE *fp);

   Description
   The function fwrite writes n elements of sizelem bytes each pointed to
   by buffer to the stream fp.

   Example
   #include <stdio.h>
   #include <stdlib.h>
   main()
   {
   char *buffer;
   unsigned sizelem,n;
   FILE *fp;
   int wrtn;
        buffer = calloc(255,1);
        sizelem = 1;
        n = 255;
        fp = fopen("file.dat","a");
        strcpy(buffer,"\nSample data\n");
        wrtn = fwrite(buffer,sizelem,n,fp);
        free(buffer);
   }

   Return Value
   The  function fwrite returns the number of complete elements  actually
   written which may be less than n if an error occurred.


See Also: fread write

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson