By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,445 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,445 IT Pros & Developers. It's quick & easy.

HELP!!! Shared Memory Error

P: 44
Hey everyone! Ive been tying to create a shared memory segment with the size of a structure, as follows:

typedef struct{
int id;
char message[1024];
}data;


In the line where i create the shared memory segment,

if((shmid = shmget(key, sizeof(data), 0766 | IPC_CREAT)) < 0){
perror("Error shmget!\n");
exit(1);
}


i get the error: 'shared memory: "Invalid Argument"'. Im using Linux SUSE and ive also tried to put into the shared memory int arrays of ten elements or less, arrays of ten chars, for example, and no matter the small the array is, wether is of ints or chars, i get always that error. Does somebody could give me a hint?

Thanks for the attention, regards
Dec 25 '06 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,510
have a look at the example programs in
http://www.cs.cf.ac.uk/Dave/C/node27.html

I have run these under SUSE 10.1
Dec 26 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.