comp.lang.ada
 help / color / mirror / Atom feed
From: "mferracini" <maurizio.ferracini@gmail.com>
Subject: need a little string hint...
Date: 28 Feb 2005 08:08:35 -0800
Date: 2005-02-28T08:08:35-08:00	[thread overview]
Message-ID: <1109606915.447479.184780@l41g2000cwc.googlegroups.com> (raw)

i need to read from a file "config.sys" host&port number.
but i have a problem with host...

if i call: Get_Host_By_Name ("localhost") it work fine,
i i use the string read from the file don't work.

an hint?

grazie.

-------------------------------------------------------------

procedure Client is
   Server     : Sock_Addr_Type;
   Config     : Ada.Text_Io.File_Type;
   Host       : String (1 .. 20)      := (others => ' ');
   Port_Value : String (1 .. 20)      := (others => ' ');
   Last       : Natural               := 0;
   Port       : Port_type             := 0;

begin
   --Inizializza
    --leggi da config
   Ada.Text_Io.Open(
      File => Config,
      Mode => Ada.Text_Io.In_File,
      Name => "config.ini"); --case sensitive?

   Ada.Text_Io.Get_Line(
      File => Config,
      Item => Host,
      Last => Last);

   Ada.Text_Io.Get_Line(
      File => Config,
      Item => Port_Value,
      Last => Last);
   Ada.Integer_Text_Io.Get(Port_Value,natural(Port),Last);

    --open socket
   Initialize(False); --true??
   Server.Addr := Addresses (Get_Host_By_Name (host), 1);
   Server.Port := Port;
   Ada.Text_Io.Put_Line("OK");




             reply	other threads:[~2005-02-28 16:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-28 16:08 mferracini [this message]
2005-02-28 16:26 ` need a little string hint Adrien Plisson
2005-02-28 16:49   ` mferracini
2005-02-28 16:53     ` Andre
2005-02-28 17:29       ` Adrien Plisson
2005-03-01 21:25         ` Simon Wright
2005-03-01 22:29           ` Adrien Plisson
2005-03-03  6:19             ` Simon Wright
2005-02-28 17:49     ` Jeffrey Carter
2005-02-28 16:51   ` mferracini
2005-02-28 16:59     ` Adrien Plisson
2005-03-01  3:07 ` Steve
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox