SYNTAX
#include "scan.h"
unsigned int scan_8long(const char *src,unsigned long *dest);
unsigned int scan_uint(const char *src,int *dest);
unsigned int scan_long(const char *src,unsigned long *dest);
unsigned int scan_ulong(const char *src,unsigned long *dest);
unsigned int scan_xint(const char *src,int *dest);
unsigned int scan_xlong(const char *src,unsigned long *dest);
DESCRIPTION
scan_8long parses an unsigned long integer in octal ASCII
representation from src and writes the result into dest. It returns the
number of bytes read from src.
scan_uint parses an unsigned integer in decimal ASCII representation
from src and writes the result into dest. It returns the number of
bytes read from src.
scan_ulong parses an unsigned long integer in decimal ASCII
representation from src and writes the result into dest. It returns the
number of bytes read from src. Leading + or - or space (or anything
outside of 0-9) is not accepted. The libc conventions of "023" for
octal or "0x23" for hexadecimal are not supported. scan_ulong will
abort the scan if the next character is not a digit, or if it is a
digit but adding it to the number would lead to an integer overflow.
scan_ulong returns the number of characters successfully scanned and
processed from src.
scan_long includes the same logic as scan_ulong but now on a signed
long integer in decimal ASCII format while recognizing the leading '+'
or '-' sign.
scan_xint parses an unsigned integer in hexadecimal ASCII
representation from src and writes the result into dest. It returns the
number of bytes read from src.
scan_xlong parses an unsigned long integer in hexadecimal ASCII
representation from src and writes the result into dest. It returns the
number of bytes read from src. scan_xlong understands both upper and
lower case letters. scan_xlong does not expect or understand a "0x"
prefix.
EXAMPLES
scan_ulong("23",&i) -> i=23, return 2
scan_ulong("+23",&i) -> return 0
scan_ulong("-23",&i) -> return 0
scan_ulong(" 23",&i) -> return 0
Man(1) output converted with
man2html