BeRTOS
Functions
strtol10.h File Reference

Poor man's hex arrays (implementation). More...

#include <cfg/compiler.h>

Go to the source code of this file.

Functions

bool strtoul10 (const char *first, const char *last, unsigned long *val)
 Convert a formatted base-10 ASCII number to unsigned long binary representation.
bool strtol10 (const char *first, const char *last, long *val)
 Convert a formatted base-10 ASCII number to signed long binary representation.
long atol (const char *str)
 Replacement for standard library function atol().
int atoi (const char *str)
 Replacement for standard library function atoi().

Detailed Description

Poor man's hex arrays (implementation).

Author:
Bernie Innocenti <bernie@codewiz.org>

Definition in file strtol10.h.


Function Documentation

bool strtol10 ( const char *  first,
const char *  last,
long *  val 
)

Convert a formatted base-10 ASCII number to signed long binary representation.

See also:
strtoul10()

Definition at line 80 of file strtol10.c.

bool strtoul10 ( const char *  first,
const char *  last,
unsigned long *  val 
)

Convert a formatted base-10 ASCII number to unsigned long binary representation.

Unlike the standard strtoul(), this function has an interface that makes it better suited for protocol parsers. It's also much simpler and smaller than a full featured strtoul().

Parameters:
firstPointer to first byte of input range (STL-style).
lastPointer to end of input range (STL-style). Pass NULL to parse up to the first \0.
valPointer to converted value.
Returns:
true for success, false for failure.
See also:
strtol10()

Definition at line 56 of file strtol10.c.