Argument array of strings

Thiago Macieira thiago at kde.org
Thu Oct 12 23:28:25 PDT 2006


Peter Clifton wrote:
>However, you will see from the output below, that it returns "54", not
>"2". Is it returning the byte count of the array? I make that about 45,
>including null terminators. Am I doing something stupid here?

It is the array length in bytes. Aside from the strings' contents and 
their null terminators, you forgot to take into account:
- each string's length indicator (4 bytes)
- the padding required between each string to align at 8 bytes

You can't get the number of elements in an array like that. You have to 
iterate over it. 

Hint: use glib. Don't venture yourself with the raw library.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20061013/86ff1a48/attachment.pgp


More information about the dbus mailing list