SW006013 Microchip Technology, SW006013 Datasheet - Page 115

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.
strtol
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
Converts a partial string to a long integer.
<stdlib.h>
long strtol(const char *s, char **endptr, int base);
s
endptr
base
Returns the converted number if successful; otherwise, returns 0.
If base is zero, strtol attempts to determine the base automatically.
It can be octal, determined by a leading zero, hexadecimal, determined
by a leading 0x or 0X, or decimal in any other case. If base is specified
strtol converts a sequence of digits and letters a-z (case insensi-
tive), where a-z represents the numbers 10-36. Conversion stops when
an out of base number is encountered. endptr will point to the remain-
der of the string starting with the first unconverted character. If a range
error occurs, errno will be set.
#include <stdio.h>
#include <stdlib.h> /* for strtol */
int main(void)
{
}
Output:
String = "-12BGEE"
Stopped at: GEE
String = "1234Number"
Stopped at: 4Number
char *end;
char a[] = "-12BGEE";
char b[] = "1234Number";
long x;
x = strtol(a, &end, 16);
printf("String = \"%s\"
printf("Stopped at: %s\n\n", end );
x = strtol(b, &end, 4);
printf("String = \"%s\"
printf("Stopped at: %s\n\n", end );
string to be converted
pointer to the character at which the conversion stopped
number base to use in conversion
/* for printf */
long = -299
long = 27
long = %ld\n", a, x );
long = %ld\n", b, x );
DS51456E-page 111

Related parts for SW006013