fprintf [C++ Reference]
Keywords: c,io,fprintf
Date: 2008-12-12T01:16:44-0800

[[fprintf]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## fprintf

Syntax:

        #include <cstdio>
        int fprintf( FILE *stream, const char *format, ... );

The fprintf() function sends information (the arguments) according to the specified format to the file indicated by stream. fprintf() works just like printf() as far as the format goes. The return value of fprintf() is the number of characters outputted, or a negative number if an error occurs. An example:

         char name[] = "Mary";
         FILE *out = fopen( "output.txt", "w" );
         if( out != NULL )
           fprintf( out, "Hello %s\n", name );

Related Topics: fputc, fputs, fscanf, printf, sprintf

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •