10d5acd74SJohn Marino.\" Copyright (c) 1993 20d5acd74SJohn Marino.\" The Regents of the University of California. All rights reserved. 30d5acd74SJohn Marino.\" 40d5acd74SJohn Marino.\" Redistribution and use in source and binary forms, with or without 50d5acd74SJohn Marino.\" modification, are permitted provided that the following conditions 60d5acd74SJohn Marino.\" are met: 70d5acd74SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 80d5acd74SJohn Marino.\" notice, this list of conditions and the following disclaimer. 90d5acd74SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 100d5acd74SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 110d5acd74SJohn Marino.\" documentation and/or other materials provided with the distribution. 12*c66c7e2fSzrj.\" 3. Neither the name of the University nor the names of its contributors 130d5acd74SJohn Marino.\" may be used to endorse or promote products derived from this software 140d5acd74SJohn Marino.\" without specific prior written permission. 150d5acd74SJohn Marino.\" 160d5acd74SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 170d5acd74SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 180d5acd74SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 190d5acd74SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 200d5acd74SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 210d5acd74SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 220d5acd74SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 230d5acd74SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 240d5acd74SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 250d5acd74SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 260d5acd74SJohn Marino.\" SUCH DAMAGE. 270d5acd74SJohn Marino.\" 280d5acd74SJohn Marino.\" @(#)digittoint.3 8.1 (Berkeley) 6/4/93 290d5acd74SJohn Marino.\" $FreeBSD: head/lib/libc/locale/digittoint.3 233648 2012-03-29 05:02:12Z eadler $ 300d5acd74SJohn Marino.\" 310d5acd74SJohn Marino.Dd April 6, 2001 320d5acd74SJohn Marino.Dt DIGITTOINT 3 330d5acd74SJohn Marino.Os 340d5acd74SJohn Marino.Sh NAME 35382f042fSSascha Wildner.Nm digittoint , 36382f042fSSascha Wildner.Nm digittoint_l 370d5acd74SJohn Marino.Nd convert a numeric character to its integer value 380d5acd74SJohn Marino.Sh LIBRARY 390d5acd74SJohn Marino.Lb libc 400d5acd74SJohn Marino.Sh SYNOPSIS 410d5acd74SJohn Marino.In ctype.h 420d5acd74SJohn Marino.Ft int 430d5acd74SJohn Marino.Fn digittoint "int c" 44382f042fSSascha Wildner.In ctype.h 45382f042fSSascha Wildner.In xlocale.h 460d5acd74SJohn Marino.Ft int 470d5acd74SJohn Marino.Fn digittoint_l "int c" "locale_t loc" 480d5acd74SJohn Marino.Sh DESCRIPTION 490d5acd74SJohn MarinoThe 500d5acd74SJohn Marino.Fn digittoint 510d5acd74SJohn Marinofunction converts a numeric character to its corresponding integer value. 520d5acd74SJohn MarinoThe character can be any decimal digit or hexadecimal digit. 530d5acd74SJohn MarinoWith hexadecimal characters, the case of the values does not matter. 540d5acd74SJohn Marino.Pp 550d5acd74SJohn MarinoThe 560d5acd74SJohn Marino.Fn digittoint_l 570d5acd74SJohn Marinofunction takes an explicit locale argument, whereas the 580d5acd74SJohn Marino.Fn digittoint 590d5acd74SJohn Marinofunction use the current global or per-thread locale. 600d5acd74SJohn Marino.Sh RETURN VALUES 610d5acd74SJohn MarinoThe 620d5acd74SJohn Marino.Fn digittoint 630d5acd74SJohn Marinofunction always returns an integer from the range of 0 to 15. 640d5acd74SJohn MarinoIf the given character was not a digit as defined by 650d5acd74SJohn Marino.Xr isxdigit 3 , 660d5acd74SJohn Marinothe function will return 0. 670d5acd74SJohn Marino.Sh SEE ALSO 680d5acd74SJohn Marino.Xr ctype 3 , 69382f042fSSascha Wildner.Xr ctype_l 3 , 700d5acd74SJohn Marino.Xr isdigit 3 , 710d5acd74SJohn Marino.Xr isxdigit 3 , 720d5acd74SJohn Marino.Xr xlocale 3 73