Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Programming/Code/Standard C Library/Functions/fprintf

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

fprintf #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[20] = "Mary"; FILE *out; out = fopen( "output.txt", "w" ); if( out != NULL ) fprintf( out, "Hello %s\n", name ); Related topics fputc - fputs - fscanf - printf - sprintf