home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 253_01 / charout.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-15  |  800 b   |  38 lines

  1.                                          /* Chapter 10 - Program 2 */
  2. #include "stdio.h"
  3. #include "string.h"
  4.  
  5. void main()
  6. {
  7. FILE *point;
  8. char others[35];
  9. int indexer,count;
  10.  
  11.    strcpy(others,"Additional lines.");
  12.    point = fopen("tenlines.txt","a"); /* open for appending */
  13.  
  14.    for (count = 1;count <= 10;count++) {
  15.       for (indexer = 0;others[indexer];indexer++)
  16.          putc(others[indexer],point);  /* output a single character */
  17.       putc('\n',point);                /* output a linefeed */
  18.    }
  19.    fclose(point);
  20. }
  21.  
  22.  
  23.  
  24. /* Result of output (appended to TENLINES.TXT)
  25.  
  26. Additional lines.
  27. Additional lines.
  28. Additional lines.
  29. Additional lines.
  30. Additional lines.
  31. Additional lines.
  32. Additional lines.
  33. Additional lines.
  34. Additional lines.
  35. Additional lines.
  36.  
  37. */
  38.