comp.lang.ada
 help / color / mirror / Atom feed
From: Roger <rogermcm2@gmail.com>
Subject: Re: Interface To C Struct That Includes An Array
Date: Mon, 17 Sep 2018 15:57:41 -0700 (PDT)
Date: 2018-09-17T15:57:41-07:00	[thread overview]
Message-ID: <7390d65b-fc95-4aff-bcb2-966516ee879b@googlegroups.com> (raw)
In-Reply-To: <pnokou$9l3$1@dont-email.me>

On Tuesday, September 18, 2018 at 2:29:20 AM UTC+10, Jeffrey R. Carter wrote:
> On 09/17/2018 02:01 PM, rogermc@iinet.net.au wrote:
> > 
> > (gdb) print Assimp_Path
> > $8 = (length => 16, data => (0 => 11, 0, 0, 0, 112, 104, 111, 101, 110, 105, 120, 46, 112, 99, 120, 0 <repeats 1009 times>)
> 
> I have no idea what I'm talking about, so this may be totally useless, but the 
> 11 0 0 0 at the beginning looks like it might be some sort of encoding marker. 
> The first of the 1009 (or is it 1010?) zeros at the end is in position 16 (index 
> 15), so I presume it's the C string terminator.
> 
> -- 
> Jeff Carter
> "Oh Lord, bless this thy hand grenade, that with it thou
> mayst blow thine enemies to tiny bits, in thy mercy."
> Monty Python and the Holy Grail
> 24

The expected data size is 1024, the first character of which is the 112.
The 11 IS  the size of the character string 112, 104, 111, 101, 110, 105, 120, 46, 112, 99, 120,
the last 0 being the (null) string terminator.
The remaining 1009 (or is it 1010?) zeros are just unused character spaces that were initialized with nulls.
The 16 seems to indicate that the whole of the expected data structure (length and data) have been interpreted (somewhere) as data and the 16 is the length of the "data".
I'm wondering if, somehow the "thing" might be a struct containing the required struct:
struct
    length.     (16)
    struct
       length.  (11)
       data      (character string)

There is another C routine that I call that returns the API_String record (struct) correctly.
This correctly returned API_String struct is actually part of another larger structure.


  reply	other threads:[~2018-09-17 22:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 12:01 Interface To C Struct That Includes An Array rogermc
2018-09-17 12:11 ` rogermc
2018-09-17 15:25   ` Lucretia
2018-09-17 22:35     ` Roger
2018-09-18  0:45       ` Roger
2018-09-18  1:19         ` rogermc
2018-09-17 12:26 ` gautier_niouzes
2018-09-17 13:28   ` Roger
2018-09-17 13:55     ` gautier_niouzes
2018-09-17 14:03       ` Roger
2018-09-17 15:24 ` Lucretia
2018-09-17 23:06   ` Roger
2018-09-17 16:29 ` Jeffrey R. Carter
2018-09-17 22:57   ` Roger [this message]
2018-09-18  0:53   ` Roger
2018-09-18  4:18     ` Roger
2018-09-18  8:19 ` rakusu_klein
2018-09-18 11:54   ` rogermc
2018-09-18 12:21     ` Egil H H
2018-09-18 12:24       ` rogermc
2018-09-18 18:55     ` rakusu_klein
2018-09-18 21:28       ` rogermc
replies disabled

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