Currently At: Programming Reference > C Reference > Stndard C I/O > fprintf()

fprintf()


Syntax:
#include <stdio.h>
int fprintf( FILE *stream, const char *format, ... );


Description:
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.

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


Related Topics:
printf(), fscanf()


Web Standards & Support:

Link to and support eLook.org Powered by LoadedWeb Web Hosting
Valid XHTML 1.0! Valid CSS! eLook.org FireFox Extensions