I am trying to write a password program on a unix machine. the problem I have, is a simple one, I get seg faults when I try to printf the pointer within the struct, "mypasswrd". I have looked everywhere to see how to do this but it doesnt seem to be possible to dereference the pointer in the printf statement.
I have included the .h file here.
the .c file is my test prog, all the linking is done and the libs are no problem I am just stuck

on this aparently simple problem
#include <sys/types.h>
struct mypasswd {
char *pw_name;// user name
char *pw_passwd;//user password
uid_t pw_uid; // user id
gid_t pw_gid; // group id
char *pw_gecos;// real name
char *pw_dir; // home directory
char *pw_time;//time last modified
};
struct mypasswd* mygetpwnam(const char* name, const char* filename);
struct mypasswd* mygetpwuid(uid_t uid, const char* filename);
int mygetpw(uid_t uid, char** buf, const char* filename);
#include <stdio.h>
#include "mypassword.h"
#include <string.h>
int main()
{
FILE *fptr;
struct mypasswd TempPw;
int uid, gid;
char name[30],passwd[20],gecos[20],dir[25],login[20];
if( (fptr = fopen("mypassword.txt","r")) == NULL)
{
printf("failed to open");
}
while( (fscanf(fptr,"%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%s\n",name,passwd,&uid,&gid,
gecos,dir,login)) != EOF)
if(uid == 114773)
{
printf("%s:%s:%d:%d:
%s:%s:%s\n",name,
passwd,
uid,
gid,
gecos,
dir,
login);
TempPw.pw_uid = uid;
TempPw.pw_gid = gid;
TempPw.pw_name = name;
/* printf("%s:%d:%d\n",
*TempPw.pw_name,
TempPw.pw_uid,
TempPw.pw_gid);*/
}
fclose(fptr);
// return TempPw;
//printf("record not found");
//fclose(fptr);
return 0;
}
_________________
Rod Bone
Sydney
Australia