00001 #ifndef _ShmAccs_CC_ 00002 #define _ShmAccs_CC_ 00003 00004 #include "../includes/Header.hh" 00005 using namespace std; 00006 00007 int shm_access(key_t shm_key, int shm_size, int *shrd_id, int *shm_ptr) 00008 { 00009 *shrd_id = shmget(shm_key, shm_size, 0444); 00010 if( *shrd_id < 0 ){ 00011 printf("Can't Access to the Shared Memory !! \n" ); 00012 return(-1); 00013 } 00014 *shm_ptr = (int)shmat( *shrd_id, (const void *)NULL, 0); 00015 00016 return *shrd_id; 00017 } 00018 #endif