Site hosted by Angelfire.com: Build your free website today!



Next: Handling Files in Up: Whole Lines of Previous: gets

puts

puts writes a string to the output, and follows it with a newline character.

Example: Program which uses gets and puts to double space typed input.


#include <stdio.h>

main()
{       char line[256]; /* Define string sufficient to 
                            store a line of input */

        while(gets(line) != NULL)   /* Read line        */
        {        puts(line);        /* Print line       */
                 printf("\n");      /* Print blank line */
        }
}