#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/sem.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include<iostream.h>
int main()
{
int iRcode;
int semid= semget(ftok("/sem", 1116), 0, 0);
if(semid == -1)
{
cout<<"error"<<endl;
}
iRcode = semctl(semid, 0, GETVAL, 0);
cout<<iRcode<<endl;
return 0;
}