SW006014 Microchip Technology, SW006014 Datasheet - Page 62

C COMPILER MPLAB FOR PIC24 MCU

SW006014

Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet

Specifications of SW006014

Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
DS51456E-page 58
fprintf
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
Prints formatted data to a stream.
<stdio.h>
int fprintf(FILE *stream, const char *format, ...);
stream
format
...
Returns number of characters generated or a negative number if an
error occurs.
The format argument has the same syntax and use that it has in
print.
#include <stdio.h> /* for fopen, fclose, */
int main(void)
{
}
Output:
Number of characters printed to file = 25
Contents of afile:
Print this string 1 time
FILE *myfile;
int y;
char s[]="Print this string";
int x = 1;
char a = '\n';
if ((myfile = fopen("afile", "w")) == NULL)
else
{
}
printf("Cannot open afile\n");
y = fprintf(myfile, "%s %d time%c", s, x, a);
printf("Number of characters printed "
fclose(myfile);
"to file = %d",y);
pointer to the stream in which to output data
format control string
optional arguments
/* fprintf, printf,
/* FILE, NULL
© 2008 Microchip Technology Inc.
*/
*/

Related parts for SW006014