From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: Convert chars_ptr to Ada String Date: Sat, 08 Jul 2017 01:48:46 +0300 Organization: Aioe.org NNTP Server Message-ID: References: <567a23f5-a7dc-4b3d-8c16-942a8551c02f@googlegroups.com> NNTP-Posting-Host: ufGwa8oybgz+8c/6CBufcw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.14.10 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:47326 Date: 2017-07-08T01:48:46+03:00 List-Id: Anh Vo wrote: > On Friday, July 7, 2017 at 2:03:32 PM UTC-7, Victor Porton wrote: >> Remind me how to convert a pair of Ptr: chars_ptr and Size: size_t to an >> Ada string. >> >> Ptr may contain NULs and this should not influence the length of the >> resulting string. > > Look at APIs defined in package Interfaces.C.Strings. I've done it: https://github.com/vporton/redland-bindings/blob/ada2012/ada/src/rdf-auxiliary-convert.adb It requires not only Interfaces.C.Strings but also Interfaces.C.Pointers to make things more confusing. -- Victor Porton - http://portonvictor.org