Try to change the order of your function calls. First shm_open, then use ftruncate(when you are creating the shared mem). After that use the mmap function.
Good luck
Frank
Apart from mistake in your code (which Frank pointed out), you can fix the compiler error by-
Quick-method
a) Use qcc !
b) Use “-fno-builtin -fhonor-std” options with gcc/g++
c) Prefix “std::” with all functions you get error like “std::strcpy”
Read the “namespaces” chapter from Stroupstrop (sorry spelling mistake probably) or Bruce Eckle’s Thinking in C++ (available online or free from eckleobjects.com)