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 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!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Passing a String to a C/C++ Subprogram (Special Case) Date: Tue, 15 Oct 2013 17:00:12 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: <9ee842b6-b053-4f4e-94df-66459ec1fb7c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 16 Oct 2013 00:00:15 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="1f3496dec3b2a953772d1e0537164117"; logging-data="21432"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zymszbQT4HQZZzzQugfn8k3aMg8skhqM=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: <9ee842b6-b053-4f4e-94df-66459ec1fb7c@googlegroups.com> Cancel-Lock: sha1:/xTXfHjvvjczSoTTAFmKMs6XlKQ= Xref: news.eternal-september.org comp.lang.ada:17431 Date: 2013-10-15T17:00:12-07:00 List-Id: On 10/15/2013 02:13 PM, Eryndlia Mavourneen wrote: > > Thanks, Jeff. This could be a good way to manage things. Unfortunately, I > can not guarantee that I can perform a trim operation or that the last > character is indeed not being used (for the placement of a nul). I suppose I > could create the wrapper, as you said, and copy the String (1 .. size) to a > String (1 .. size + 1) and place a nul in the last character of the target > string. Of course, this does not add a lot of overhead for short strings, > but it is a hard real-time system. I would use the To_C or New_String functions to ensure that what is being passed to C is convention-C and NUL-terminated. -- Jeff Carter "Help! Help! I'm being repressed!" Monty Python & the Holy Grail 67