SW006013 Microchip Technology, SW006013 Datasheet - Page 133

MPLAB C Compiler For DsPIC DSCs

SW006013

Manufacturer Part Number
SW006013
Description
MPLAB C Compiler For DsPIC DSCs
Manufacturer
Microchip Technology
Series
DsPIC30F/33Fr
Type
MPLAB® C Compilerr
Datasheet

Specifications of SW006013

Supported Families
DsPIC30F, DsPIC33F
Core Architecture
DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
DsPIC30F And DsPIC33F
Tool Function
Compiler
Tool Type
Compiler
Processor Series
dsPIC
Lead Free Status / RoHS Status
na
For Use With/related Products
dSPIC DSCs
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
© 2008 Microchip Technology Inc.
strncmp (Continued)
strncpy
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
else
}
Output:
buf1 : Where is the time?
buf2 : Where did they go?
buf3 : Why?
6 characters of buf1 and buf2 are equal
buf2 comes before buf1
buf1 comes before buf3
Copy characters from the source string into the destination string, up to
the specified number of characters.
<string.h>
char *strncpy(char *s1, const char *s2, size_t n);
s1
s2
n
Returns a pointer to the destination string.
Copies n characters from the source string to the destination string. If
the source string is less than n characters, the destination is filled with
null characters to total n characters. If n characters were copied and no
null character was found then the destination string will not be null-ter-
minated. If the strings overlap, the behavior is undefined.
#include <string.h> /* for strncpy, strlen */
#include <stdio.h>
int main(void)
{
printf("\n");
res = strncmp(buf1, buf3, 20);
if (res < 0)
else if (res == 0)
char buf1[50] = "We're here";
char buf2[50] = "Where is the time?";
char buf3[50] = "Why?";
char buf4[7]
printf("buf1 : %s\n", buf1);
printf("buf2 : %s\n", buf2);
printf("buf3 : %s\n", buf3);
printf("buf4 : %s\n", buf4);
printf("buf1 comes before buf3\n");
printf("20 characters of buf1 and buf3 "
printf("buf3 comes before buf1\n");
"are equal\n");
destination string to copy to
source string to copy from
number of characters to copy
= "Where?";
/* for printf
DS51456E-page 129
*/

Related parts for SW006013