[Previous]
[Contents]
[Next]

fprintf()

write output to a file

Synopsis:

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

Description:

The fprintf() function writes output to the file pointed to by fp, under control of the argument format. The format string is described under the description of the printf() function.

Returns:

The number of characters written, or a negative value if an output error occurred. When an error has occurred, errno indicates the type of error detected.

Examples:

#include <stdio.h>

char *weekday = { "Saturday" };
char *month = { "April" };

void main()
  {
    fprintf( stdout, "%s, %s %d, %d\n",
      weekday, month, 18, 1987 );
  }

produces the output:

Saturday, April 18, 1987

Classification:

ANSI

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

_bprintf(), cprintf(), errno, printf(), sprintf(), _vbprintf(), vcprintf(), vfprintf(), vprintf(), vsprintf()


[Previous]
[Contents]
[Next]