comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Simple Stream_IO question
Date: 1996/10/21
Date: 1996-10-21T00:00:00+00:00	[thread overview]
Message-ID: <dewar.845944027@merv> (raw)
In-Reply-To: Pine.LNX.3.91.961021132826.300A-100000@e229b-1.ensu.ucalgary.ca


John provides the following incorrect program:

with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;

procedure Foo is

   F : Float;
   I : Integer;

   File : File_Type;

begin

   Open(File, In_File, "foo.adb");

   Float'Read(File, F);
   Integer'Read(File, I);

   Close(File);

end Foo;

You have to pay attention to types in Ada, the Read attribute has the 
profile

6   S'Read
                S'Read denotes a procedure with the following specification:

7                   procedure S'Read(
                       Stream : access Ada.Streams.Root_Stream_Type'Class;
                       Item : out T)


But your first argument is of type Streams.Stream_IO.File_Type which is
completely wrong. 

You ned to use Streams.Stream_IO.Stream!






  reply	other threads:[~1996-10-21  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-21  0:00 Simple Stream_IO question John Raquet
1996-10-21  0:00 ` Robert Dewar [this message]
1996-10-22  0:00 ` Norman H. Cohen
1996-10-22  0:00 ` John English
replies disabled

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