2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Convert a string into a long
9 /*****************************************************************************
12 #include <proto/dos.h>
14 AROS_LH2I(LONG
, StrToLong
,
17 AROS_LHA(CONST_STRPTR
, string
, D1
),
18 AROS_LHA(LONG
*, value
, D2
),
21 struct DosLibrary
*, DOSBase
, 136, Dos
)
24 Convert a string to a long number.
27 string - The value to convert
28 value - The result is returned here
31 How many characters in the string were considered when it was
32 converted or -1 if no valid number could be found.
35 The routine doesn't check if the number if too large.
38 // Valid number are: 5, -1, +3, +0007, etc.
46 *****************************************************************************/
49 AROS_LIBBASE_EXT_DECL(struct DosLibrary
*,DOSBase
)
52 CONST_STRPTR s
=string
;
54 /* Skip leading whitespace characters */
62 /* If there is no number return an error. */
69 /* Calculate result */
72 while(*s
>='0'&&*s
<='9');