Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fputc(DOS) — System V/386 Software Development System 3.2.2b

Media Vault

Software Library

Restoration Projects

Artifacts Sought

     Name
          fputc, fputchar - Writes a character to a stream.

     Syntax
          #include <stdio.h>

          int fputc(c, stream)
          int c;
          FILE *stream;

          int fputchar(c)
          int c;

     Description
          The fputc function writes the single character c to the
          output stream at the current position. The fputchar function
          is equivalent to fputc(c, stdout).

     Return Value
          The fputc and fputchar functions return the character
          written. A return value of EOF indicates an error.

     Notes
          The fputc and fputchar routines are similar to putc and
          putchar, but are functions, not macros.

     See Also
          fgetc(DOS), fgetchar(DOS), putc(S), putchar(S)

     Example
          #include <stdio.h>

          FILE *stream; char buffer[81]; int i; int ch;

          main()
           {
                  stream = stdout;

                  /* Demonstrate "fputc" and
                  ** set up the buffer:
                  */
                  strcpy(buffer, "This is a test of fputc!!\n");

                  /* Print line to stream */
                  for (i = 0; ( i < 81 ) &&
                          ((ch = fputc(buffer[i],stream)) != EOF);
          i++);

                  /* Demonstrate "fputchar" and
                  ** set up the buffer:
                  */
                  strcpy(buffer, "This is a test of fputchar!!");

                  /* Print line to stream */
                  for (i = 0; ( i < 81 ) &&
                          ((ch = fputchar(buffer[i])) != EOF); i++);
           }

          This program uses fputc and fputchar to send a character
          array to stdout.
                                                (printed 6/18/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026