Pointer. You can always extract anything else from that.
On Feb 13, 2008, at 11:24 AM, Ola Bini wrote:
Hi
I'm trying to map the group structure of grp.h. It's C definition is
quite simple:
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
int gr_gid; /* group id */
char **gr_mem; /* group members */
};
I want to use getgrent(), which returns one of these babies.
The problem is gr_mem. What should that be? I've tried using
StringArray
- this results in:
Exception in thread "main" java.lang.IllegalArgumentException: Type
class com.sun.jna.StringArray has unknown native alignment
at com.sun.jna.Structure.getNativeAlignment(Structure.java:841)
at com.sun.jna.Structure.calculateSize(Structure.java:766)
at com.sun.jna.Structure.allocateMemory(Structure.java:203)
at com.sun.jna.Structure.<init>(Structure.java:126)
at com.sun.jna.Structure.<init>(Structure.java:120)
at com.sun.jna.Structure.<init>(Structure.java:116)
(I'm on MacOS X 10.4)
Now, I imagine there must be a simple way to handle this. the
problem is
that the gr_mem data doesn't come with any information about the
length
of the contents, meaning that I can't preallocate an array of
Strings or
something like that.
How should this be handled?
Cheers
"Yields falsehood when quined" yields falsehood when quined.