From: Mark Lorenzen <mark.lorenzen@gmail.com>
Subject: Re: Convert chars_ptr to Ada String
Date: Mon, 10 Jul 2017 05:41:53 -0700 (PDT)
Date: 2017-07-10T05:41:53-07:00 [thread overview]
Message-ID: <29cb4699-2faf-4da3-8ed8-f01909054b4f@googlegroups.com> (raw)
In-Reply-To: <ojviha$50i$1@gioia.aioe.org>
On Monday, July 10, 2017 at 11:48:29 AM UTC+2, Dmitry A. Kazakov wrote:
> On 10/07/2017 11:31, Victor Porton wrote:
>
> > Read description of Value() carefully. It stops at first NUL.
>
> if Ptr = Null_Ptr then
> return "";
> else
> return To_Ada (Value (Ptr, Length), False);
> end if;
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
I don't think that it will work as (if I understand it correctly) the string the OP tries to convert may contain NULL characters that are not to be interpreted as string terminators.
I think the problem is, that the OP is confused about the difference between C strings and C arrays of characters and tries to use Interfaces.C.Strings to manipulate C arrays of characters thar are not be interpreted as C strings but as simple arrays of characters.
Maybe Interfaces.C.Pointers is more appropriate?
Regards,
Mark L
next prev parent reply other threads:[~2017-07-10 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-07 21:03 Convert chars_ptr to Ada String Victor Porton
2017-07-07 22:23 ` Anh Vo
2017-07-07 22:48 ` Victor Porton
2017-07-07 23:14 ` Anh Vo
2017-07-09 6:49 ` Victor Porton
2017-07-10 4:58 ` Anh Vo
2017-07-10 9:31 ` Victor Porton
2017-07-10 9:48 ` Dmitry A. Kazakov
2017-07-10 12:41 ` Mark Lorenzen [this message]
2017-07-10 14:24 ` Dmitry A. Kazakov
2017-07-10 21:21 ` Victor Porton
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox