| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Converts a string of digits to an integer of the specified base.
CtoN( <cDigits> , ;
[<nBase>] , ;
[<lNegative>]) --> nInteger
The function returns a numeric integer value.
| See also: | NtoC(), NumToHex() |
| Category: | CT:NumBits , Numbers and Bits |
| Source: | ct\numconv.prg |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays results of number conversions.
PROCEDURE Main
? CtoN( "123" ) // result: 123
? CtoN( "123A", 16 ) // result: 4666
? NumToHex( 4666 ) // result: 123A
? CtoN( "1101", 2 ) // result: 13
? NtoC( 11 , 2 ) // result: 1101
RETURN
http://www.xHarbour.com