fprintf

Writes output to a stream under format control

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

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

Parameters

fp
(IN) Points to the file to be written to.
format
(IN) Points to the format control string.

Return Values

The fprintf function returns the number of characters written or a negative value if an output error occurred. If an error occurs, errno is set.

Remarks

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.

See Also

printf, sprintf, vfprintf

fprintf Example

  #include <stdio.h> 
   
  main ()  
  {  
     char   *weekday = {"Saturday"};  
     char   *month = {"April"};  
     fprintf (stdout, "%s, %s %d, %d\n", weekday, month, 18, 1991);  
  }
  

produces the following:

  Saturday, April 18, 1991