SW006014 Microchip Technology, SW006014 Datasheet - Page 82

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 78
rewind
Description:
Include:
Prototype:
Argument:
Remarks:
Example:
Resets the file pointer to the beginning of the file.
<stdio.h>
void rewind(FILE *stream);
stream
The function calls fseek(stream, 0L, SEEK_SET) and then clears
the error indicator for the given stream.
#include <stdio.h> /* for rewind, fopen, */
int main(void)
{
}
Output:
I have 10 cookies.
I ate 10 cookies.
FILE *myfile;
char s[] = "cookies";
int x = 10;
if ((myfile = fopen("afile", "w+")) == NULL)
else
{
}
printf("Cannot open afile\n");
fprintf(myfile, "%d %s", x, s);
printf("I have %d %s.\n", x, s);
/* set pointer to beginning of file */
rewind(myfile);
fscanf(myfile, "%d %s", &x, &s);
printf("I ate %d %s.\n", x, s);
fclose(myfile);
stream to reset the file pointer
/* fscanf, fclose,
/* fprintf, printf,
/* FILE, NULL
© 2008 Microchip Technology Inc.
*/
*/
*/

Related parts for SW006014