title: Ada: reading from a file
body: <p>I am trying to read a file with a single column of <code>Long_Float</code> values in <code>Ada</code> as follows:</p>
  
  <pre><code>with Ada.Text_IO; use Ada.Text_IO;
  with Ada.Long_Float_Text_IO;
  with Ada.Sequential_IO;
  
  
  procedure Test_Read is
  
    package Seq_Float_IO is new Ada.Sequential_IO (Element_Type =&gt; Long_Float);
  
    Input_File    : File_Type;
    value         : Long_Float;
  
  begin
  
    Seq_Float_IO.Open (File =&gt; Input_File, Mode =&gt; Seq_Float_IO.In_File, Name =&gt; "fx.txt");
    while not End_OF_File (Input_File) loop
      Seq_Float_IO.Read (Input_File, value);
      Ada.Long_Float_Text_IO.Put (Item =&gt; value, Fore =&gt; 3, Aft  =&gt; 5, Exp  =&gt; 0);
    end loop;
    Seq_Float_IO.close (File =&gt; Input_File);
  
  end Test_Read;
  </code></pre>
  
  <p>I do get lots of error messages on compilation:</p>
  
  <pre><code>17.       Seq_Float_IO.Open (File =&gt; Input_File, Mode =&gt; Seq_Float_IO.In_File, Name =&gt; "fx.txt");
                                       |
      &gt;&gt;&gt; expected private type "Ada.Sequential_Io.File_Type" from instance at line 10
      &gt;&gt;&gt; found private type "Ada.Text_Io.File_Type"
  
  18.       while not End_OF_File (Input_File) loop
  19.         Seq_Float_IO.Read (Input_File, value);
                                 |
      &gt;&gt;&gt; expected private type "Ada.Sequential_Io.File_Type" from instance at line 10
      &gt;&gt;&gt; found private type "Ada.Text_Io.File_Type"
  </code></pre>
  
  <p>The file <code>fx.txt</code> contains for example:</p>
  
  <pre><code>11.0
  23.0
  35.0
  46.0
  </code></pre>
  
  <p>Any help will be most appreciated.</p>
  
  <p><strong>Updated Code:</strong></p>
  
  <pre><code>with Ada.Text_IO; use Ada.Text_IO;
  
  
  procedure Test_Read is
  
     Input_File    : File_Type;
     value         : Character;
  
  begin
  
     Ada.Text_IO.Open (File =&gt; Input_File, Mode =&gt; Ada.Text_IO.In_File, Name =&gt; "fx.txt");
  
     while not End_OF_File (Input_File) loop
        Ada.Text_IO.Get (File =&gt; Input_File, Item =&gt; value);
        Ada.Text_IO.Put (Item =&gt; value);
        Ada.Text_IO.New_Line;
     end loop;
     Ada.Text_IO.Close (File =&gt; Input_File); 
  
  end Test_Read;
  </code></pre>
  
  <p>But now the output is:</p>
  
  <pre><code>1
  1
  .
  0
  2
  3
  .
  0
  3
  5
  .
  0
  4
  6
  .
  </code></pre>
  
  <p>The problem is that <code>value</code> is defined as a <code>character</code>. If I want <code>value</code> to be of the type <code>Long_Float</code> so that I can use the numbers <code>11.0, 23.0, 35.0 and 46.0</code> later on in my program, then how to go about?</p>
  
  <p>Thanks.</p>