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 PAA16806; Sat, 7 Feb 2004 15:59:15 +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 PAA17959 for ; Sat, 7 Feb 2004 15:59:14 +0100 (MET) Received: from mwinf0503.wanadoo.fr (smtp5.wanadoo.fr [193.252.22.26]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i17ExDv27980 for ; Sat, 7 Feb 2004 15:59:13 +0100 (MET) Received: from vanicat.homelinux.org (ca-bordeaux-11-146.w80-8.abo.wanadoo.fr [80.8.83.146]) by mwinf0503.wanadoo.fr (SMTP Server) with ESMTP id 7898F6800146 for ; Sat, 7 Feb 2004 15:59:13 +0100 (CET) Received: from moi by vanicat.homelinux.org with local (Exim 3.36 #1 (Debian)) id 1ApTvt-0001P6-00 for ; Sat, 07 Feb 2004 15:59:45 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] How to read a password without displaying it? References: <87u123rqyn.fsf@linux-france.org> <20040207131730.GA20547@ours.starynkevitch.net> <87d68rrlrc.fsf@linux-france.org> From: Remi Vanicat Mail-Copy-To: never Date: Sat, 07 Feb 2004 15:59:45 +0100 In-Reply-To: <87d68rrlrc.fsf@linux-france.org> (David MENTRE's message of "Sat, 07 Feb 2004 15:45:43 +0100") Message-ID: <87ad3vvsta.dlv@vanicat.homelinux.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dmentre:01 basile:01 maxence:01 tcgetattr:01 stdin:01 tcsetattr:01 stdin:01 tcsaflush:01 tcsetattr:01 tcsaflush:01 caml:01 writes:01 remi:01 remi:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk David MENTRE writes: > Thank you Basile and Maxence for your replies, > > In fact, I wanted to do that in caml only, to be portable on Windows > and I'm relunctant to bind to C code. However, from what you said, > it seems impossible. Well, I would try to use the Terminal interface of the Unix library : open Unix let read_pass () = let attr = tcgetattr stdin in tcsetattr stdin TCSAFLUSH { attr with c_echo = false }; let line = read_line () in tcsetattr stdin TCSAFLUSH attr; line It work. Of course you could do something to print * when the user type something, but this is a first solution. By the way i don't know if this work on windows. -- Rémi Vanicat ------------------- 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