RAD Studio
ContentsIndex
PreviousUpNext
fprintf, fwprintf

Header File 

stdio.h  

Category 

Input/output Routines 

Prototype 

int fprintf(FILE *stream, const char *format[, argument, ...]); 

int fwprintf(FILE *stream, const wchar_t *format[, argument, ...]); 

Description 

Writes formatted output to a stream. 

fprintf accepts a series of arguments applies to each a format specifier contained in the format string pointed to by format and outputs the formatted data to a stream. There must be the same number of format specifiers as arguments.

Note: For details on format specifiers, see printf Format Specifiers.
Return Value 

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

Example  

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

Portability

 
POSIX 
Win32 
ANSI C 
ANSI C++ 
fprintf 
fwprintf 
 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!