Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] How do I convert 0x hexadecimal integers to decimal integers ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stalkern 2 <stalkern2@t...>
Subject: Re: [Caml-list] How do I convert 0x hexadecimal integers to decimal integers ?
Il  Thursday 27 March 2003 18:20, Stalkern 2 ha scritto:
> Hello to everybody
> I'd  need a function to turn hexadecimal integers like
> 	0xb8f99c
> ( a Color in hexadecimal notation) to integer 3ples (e.g. `RGB
> (184*256,249*256,156*256), always a color).
>
> Shall I use Scanf functions and then some function converting hexadecimal
> numbers to decimal? what would this function be?

Well I see that I can also use String.sub but my problem would still be to 
convert a hexadecimal integer like 0xb8f99c into a string like "0xb8f99c", 
avoiding things like 
	# string_of_int 0xffffff;;
 	- : string = "16777215"
because in this case I don't know how to recognize the 3 integers that are 
side by side... are they side by side because of a convention or is there a 
way to convert "16777215" into the triple that I'm looking for?

T I A 
Ernesto

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners