comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: How to use GNAT.Serial_Communications ?
Date: Sat, 14 Sep 2013 06:42:30 +0100
Date: 2013-09-14T06:42:30+01:00	[thread overview]
Message-ID: <lytxho5589.fsf@pushface.org> (raw)
In-Reply-To: 05ecdd0e-41cf-4961-88db-22e0a8cba3f6@googlegroups.com

elbric0 <jasmin.stlaurent@gmail.com> writes:

> with GNAT.Serial_Communications; use GNAT.Serial_Communications;
>
> procedure Test_Serial is
>
>    Serial : Serial_Port;

     Serial : aliased Serial_Port;

>    C : Character;
>
> begin
>
>    Open (Port => Serial, Name => Name (1));
>
>    C := 'A';
>
>    Character'Write (Serial, C);

     Character'Write (Serial'Access, C);

>    Close (Serial);
>
> end Test_Serial;
> ----------------------------------------------------------------
>
> However the type of the first parameter of Character'Write is not
> correct. I get this error message: "expected access to
> Ada.Streams.Root_Stream_Type'Class".
>
> Can someone tell me what I should put there instead of Serial?

... as above; in GNAT.Serial_Communications,

   type Serial_Port is new Ada.Streams.Root_Stream_Type with private;

and, as the error message said, you need an access to one of those.

Serial has to be declared aliased so that 'Access can be taken
(otherwise, who knows, it might be kept in a register).

> Do you know any tutorial or code example that can help me?

Sorry, someone else may.


  reply	other threads:[~2013-09-14  5:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-14  1:39 How to use GNAT.Serial_Communications ? elbric0
2013-09-14  5:42 ` Simon Wright [this message]
2013-09-14 12:10   ` jasmin.stlaurent
replies disabled

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