SW006014 Microchip Technology, SW006014 Datasheet - Page 76

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 72
gets (Continued)
Example:
perror
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Example:
#include <stdio.h> /* for gets, printf */
int main(void)
{
}
Input:
Contents of UartIn.txt (used as stdin input for simulator):
Short
Longer string
Output:
Text: Short
Prints an error message to stderr.
<stdio.h>
void perror(const char *s);
s
None.
The string s is printed followed by a colon and a space. Then an error
message based on errno is printed followed by an newline
#include <stdio.h> /* for perror, fopen, */
int main(void)
{
}
Output:
Cannot open samp.fil:
char y[50];
gets(y) ;
printf("Text: %s\n", y);
FILE *myfile;
if ((myfile = fopen("samp.fil", "r+")) == NULL)
else
fclose(myfile);
perror("Cannot open samp.fil");
printf("Success opening samp.fil\n");
string to print
/* fclose, printf,
/* FILE, NULL
file open error
© 2008 Microchip Technology Inc.
*/
*/

Related parts for SW006014