Quantcast
Channel: How does shmget allocate memory? Cannot access with linear addressing (Address Boundary error) - Stack Overflow
Browsing index pages (2 articles)
↧

How does shmget allocate memory? Cannot access with linear addressing...

In the following example, I'm trying to use shmget to allocate memory for one integer, and 10 foo structs and trying to access them linearly. However, it errors out with an "Address Boundary error"....

View Article


Answer by Sam Varshavchik for How does shmget allocate memory? Cannot access...

char* shmemPtr = (char*) shmat(shmid, 0, 0); You've got now a pointer to your shared memory block. It is a char *, pointing to the start of the block. So far, so good. int* iPtr = (int*) shmemPtr[0];...

View Article

Browsing index pages (2 articles)


Latest Images