Okay look first thanks for this place :) I would like to create a piece of shared memory to store 30 structures of the same type, but I am getting errors on compile..
struct nota
{
int n;
char text[30];
char titulo[100];
char login[20];
}
main(){
int shmID;
struct nota *evernota;
struct nota um;
shmID = shmget(1009, sizeof(struct nota)*30 , 0666 | IPC_CREAT);
evernota = shmat(shmID, NULL, 0);
evernota[0] = &um; //Declaring one note here to the first position of shm..
evernota[20] = &um; //Declaring the same note on the 20 position of shm..
printf("o meu int é %d\n",evernota[0]->n); //Here I would get the int n of each structure, that should be 0, because its not initialized..
printf("o meu int é %d\n",evernota[20]->n); //and there the same n, because I use the same structure on position 0 and 20..
}
But I have compile errors, someone see where is the problem?? Thanks alot in advance!!!