ok.
I tried it like this. Used below structure and struct "forShm" to insert in shared memory. I am able to copy data and do all. But while reading seems it is getting some garbage. I believe i messed up something.
Code:
typedef struct userList
{
char userName[64];
int socketFd;
int gpReady;
}listUsers;
struct forShm
{
listUsers userInfo[10];
int numUsers;
int numGpUsers;
};
shmid = shmget((key_t)1234, sizeof(struct forShm)*10, 0666 | IPC_CREAT);
sh_mem = shmat(shmid, (void *)0, 0);
fromShm = (struct forShm*)sh_mem;
strcpy(fromShm->userInfo[count].userName,tokName);
fromShm->userInfo[count].socketFd = sockfd;
count=count+1;
fromShm->numUsers = count;