Borland C++ reference

fprintf

raw OCR

Writes formatted output to a stream.

Defined in header <stdio.h>

Syntax

#include <stdio.h>
int fprintf(FILE *stream, const char *format[, argument, ...]);

Portability

DOSUNIXWindowsANSI CC++ only
■■■■

Remarks

fprintf accepts a series of arguments, applies to each a format specifier contained in the format string pointed to hy format, and outputs the

See printf for details

formatted data to a stream. There must be the same number of format

on format specifiers,

specifiers as arguments.

Return value

fprintf returns the number of bytes output. In the event of error, it returns EOF.

See also

Example

#include <stdio.h>

int main(void)
{
   FILE *stream;
   int i = 100;
   char c = 'C';
   float f = 1.234;
   stream - fopen("DUMMY.FIL", "w+");    /* open a file for update */
   fprintf(stream, "%d %c %f", i, c, f); /* write some data to the file */
   fclose(stream);   /* close the file */
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.