comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: converting - adasockets
Date: 18 Jun 2001 13:13:49 -0400
Date: 2001-06-18T17:29:35+00:00	[thread overview]
Message-ID: <uelsh3e42.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 20010611.085009.1789366143.627@zamek.gda.pl

"Micha� Nowikowski" <godfryd@zamek.gda.pl> writes:

> Hello
> 
> Im writting a program which reads some data from a socket 
> (i used adasockets). And i've problem with converting
> this date from String to fg Integer. How could i do that.
> In C it woul look like:
> 
>  char s[10];
>  int i;
> 
>  i = *(int*)s;
> 
> but in Ada?

I have not seen AdaSockets, but I assume it returns data as a 'Stream',
not a 'String' (otherwise it's not Real Ada). So you want to use
Integer'read.

However, you should not be using type Integer, since the compiler does
not guarrantee it has the same size on both ends of the socket. You
should use your own integer type, with a specified size, or one of the
ones in package Interface.

-- 
-- Stephe



      parent reply	other threads:[~2001-06-18 17:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-11  6:50 converting - adasockets 
2001-06-11  9:22 ` Gerald Kasner
2001-06-11 10:17 ` David C. Hoos, Sr.
2001-06-11 11:45   ` Gerald Kasner
2001-06-11 15:59     ` James Rogers
2001-06-11 16:29       ` James Rogers
2001-06-12  1:19         ` Ken Garlington
2001-06-12  4:41           ` James Rogers
2001-06-11 16:33 ` tmoran
2001-06-18 17:13 ` Stephen Leake [this message]
replies disabled

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