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).

Version:
Id
strtol10.h 2506 2009-04-15 08:29:07Z duplo
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 81 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:
first Pointer to first byte of input range (STL-style).
last Pointer to end of input range (STL-style). Pass NULL to parse up to the first \0.
val Pointer to converted value.
Returns:
true for success, false for failure.
See also:
strtol10()

Definition at line 57 of file strtol10.c.