From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,5a8b3d7ed8d4ae38,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-25 21:36:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: Mauricio Tellez Newsgroups: comp.lang.ada Subject: Problem with Get_Line Date: Wed, 25 Sep 2002 23:35:27 -0600 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 1033014963 30286 137.194.161.2 (26 Sep 2002 04:36:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 26 Sep 2002 04:36:03 +0000 (UTC) Return-Path: Content-Disposition: inline User-Agent: Mutt/1.3.28i Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:29345 Date: 2002-09-25T23:35:27-06:00 Hi, I'm new to Ada but with some years of experience in C. I write a small program to practice but with an result. The program is kind of address book. The problem is that a call to Get_Line seems to not execute. Why? As you can see in the code I'm still influenced by C so any comment about the code is also welcome. Thanks in advance. This is code: with Ada.Text_Io, Ada.Strings, Ada.Integer_Text_Io; use Ada.Text_Io, Ada.Strings, Ada.Integer_Text_Io; procedure Agenda is type Agenda_Record is record Nombre : String ( 1 .. 30 ); Len : Integer; Usado : Character := 'N'; end record; Max : constant Integer := 3; type Agenda_Type is array(1 .. Max) of Agenda_Record; Agenda : Agenda_Type; Opc : Integer; function Regresa_Libre (Agenda : in Agenda_Type) return Integer is begin for I in 1 .. Max loop if Agenda(I).Usado = 'N' then return I; end if; end loop; return 0; end Regresa_Libre; procedure Lee_Nombres (Agenda : out Agenda_Type) is Pos : Integer := 1; begin Pos := Regresa_Libre(Agenda); Flush; Put_Line("La posicion es: "); Put(Pos); if Pos = 0 then Put_Line("No hay espacio en la agenda"); else Put_Line("Nombre: "); -- This Get_Line do not execute!!! Get_Line(Agenda(Pos).nombre, Agenda(Pos).Len); end if; end Lee_Nombres; begin loop Put_Line("** Agenda en Ada95 **"); Put_Line(""); Put_Line("1. Insertar registros a la agenda"); Put_Line("9. Salir"); Put_Line(""); Put("Opcion> "); Get(Opc); exit when Opc = 9; case Opc is when 1 => Lee_Nombres(Agenda); when others => Put_Line("Opcion Incorrecta!!!"); end case; end loop; Lee_Nombres( Agenda ); Put_Line("Los nombres leidos son:"); for I in 1 .. Max loop Put_Line(Agenda(I).Nombre); Put(Agenda(I).Len); end loop; end Agenda; -- Mauricio T�llez Jim�nez Facultad de Inform�tica UV mtellez@xal.megared.net.mx Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots. So far, the universe is winning. Richard Cook