SW006013 Microchip Technology, SW006013 Datasheet - Page 116

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
DS51456E-page 112
strtoul
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
Converts a partial string to an unsigned long integer.
<stdlib.h>
unsigned long strtoul(const char *s, char **endptr,
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 strtoul */
int main(void)
{
}
Output:
String = "12BGET3"
Stopped at: T3
String = "0x1234Number"
Stopped at: Number
String = "-123abc"
Stopped at: abc
int base);
char *end;
char a[] = "12BGET3";
char b[] = "0x1234Number";
char c[] = "-123abc";
unsigned long x;
x = strtoul(a, &end, 25);
printf("String = \"%s\"
printf("Stopped at: %s\n\n", end );
x = strtoul(b, &end, 0);
printf("String = \"%s\"
printf("Stopped at: %s\n\n", end );
x = strtoul(c, &end, 0);
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 = 429164
long = 4294967173
long = 4660
long = %lu\n", a, x );
long = %lu\n", b, x );
long = %lu\n", c, x );
© 2008 Microchip Technology Inc.
*/

Related parts for SW006013