Translations of this page?:

putc

语法:

    #include <cstdio>
    int putc( int ch, FILE *stream );

putc()函数想stream写入字符ch。返回值是写入的字符,如果出现错误返回EOF。例如

     int ch;
     FILE *input, *output;
     input = fopen( "tmp.c", "r" );
     output = fopen( "tmpCopy.c", "w" );
     ch = getc( input );
     while( ch != EOF ) {
       putc( ch, output );
       ch = getc( input );
     }
     fclose( input );
     fclose( output );

生成一个tmp.c文件的拷贝叫做tmpCopy.c.

相关主题: feof, fflush, fgetc, fputc, getc, getchar, putchar, puts

 
• • • SitemapRecent changesRSScc