Novice question on vectors of pointers
John J. Rushford Jr
jjr at rushpc
Mon Apr 29 15:13:13 AEST 1991
I hope this question is not too OS specific. Point me elsewhere if it is.
How does one use a vector of pointers to member names. I'm specifically
trying to use getgrnam(3C) in UNIX SVR3.2 and I want to print to 'stdout'
all the entries in **gr_mem. Below is an example of what I'm trying to
work with. I don't have any problem with the remaining elements in the
structure. It's **gr_mem I don't understand. How do you work with it?
EXAMPLE:
#include <stdio.h>
/* From '/usr/include/grp.h'
struct group {
char *gr_name; /* the name of the group */
char *gr_passwd; /* the encrypted group password */
int gr_gid; /* the numerical group ID */
char **gr_mem; /* vector of pointer to member names */
};
struct group *pntr, *getgrnam();
main()
{
pntr = getgrnam("other");
fprintf(stdout, "%s\n", pntr->gr_name);
fprintf(stdout, "%s\n", pntr->gr_passwd);
fprintf(stdout, "%d\n", pntr->gr_gid);
return 0;
}
thanks a ton.
--
John
----
Westminster Colorado
More information about the Comp.lang.c
mailing list