From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA16179; Thu, 27 Mar 2003 18:47:22 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA15947 for ; Thu, 27 Mar 2003 18:47:21 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from smtp1.cp.tin.it (vsmtp1.tin.it [212.216.176.221]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h2RHlJX09449 for ; Thu, 27 Mar 2003 18:47:20 +0100 (MET) Received: from favilla.biomedin.int (212.171.41.25) by smtp1.cp.tin.it (6.5.033) id 3E70BBAC005D8936 for caml-list@inria.fr; Thu, 27 Mar 2003 18:47:18 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Stalkern 2 Reply-To: stalkern2@tin.it To: caml-list@inria.fr Subject: Re: [Caml-list] How do I convert 0x hexadecimal integers to decimal integers ? Date: Thu, 27 Mar 2003 18:54:55 +0100 User-Agent: KMail/1.4.3 References: <200303271820.34803.stalkern2@tin.it> In-Reply-To: <200303271820.34803.stalkern2@tin.it> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200303271854.55964.stalkern2@tin.it> X-Spam: no; 0.00; stalkern:01 caml-list:01 scanf:01 avoiding:01 xffffff:01 ernesto:01 int:01 string:03 functions:05 decimal:05 color:94 integers:05 hexadecimal:05 converting:05 integer:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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