home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / r_la4_02 / warray.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-01-07  |  562 b   |  21 lines

  1. /* WARRAY.C - From page 450 of "Microsoft C Programming for     */
  2. /* the IBM" by Robert Lafore. Writes an array to a file using   */
  3. /* binary mode.                                                 */
  4. /****************************************************************/
  5.  
  6. #include "stdio.h"
  7. int table[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  8.  
  9. main()
  10. {
  11. FILE *fptr;
  12.  
  13.    if((fptr = fopen("c:table.rec", "wb")) == NULL) {
  14.       printf("\nCan't open file agents.rec");
  15.       exit();
  16.    }
  17.    fwrite(table, sizeof(table), 1, fptr);
  18.    fclose(fptr);
  19. }
  20.  
  21.