#include <stdio.h> int putchar(int c);
putchar
writes a character c
to the stream stdout
.
putchar
returns the character written or EOF
if an error occurs.
stdout
:
#include <stdio.h> #include <string.h> #include <stdlib.h> main() { int c; FILE *infile; char filename[60]; puts("Enter the name of your input file:"); memcpy(filename, "tso:", 4); gets(filename+4); infile = fopen(filename, "r"); if (!infile){ puts("Failed to open input file."); exit(EXIT_FAILURE); } /* While character is not a newline character, */ /* read character from file MYFILE. */ while (((c = getc(infile)) != 'n') && (c != EOF)) /* Write one character of the file to the */ /* standard output; this line is written one */ /* character at a time. */ putchar(c); putchar('/n'); }
putc
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.