求解答啊!!!
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <string.h>
#include <stdlib.h>
#define NAME "/tmp/lhb/myshm"
int main(int argc,char *argv[])
{
int shmid;
key_t key;
char *w_addr;
key = ftok(NAME,'a');
if(key == -1)
{
printf("key erro\n");
}
printf("key = %d\n",key);
if(argc != 2)
{
printf("argv erro\n");
}
shmid = shmget(key,1024,O_RDWR);
printf("shmid = %d\n",shmid);
if(shmid == -1)
{
printf("shmget erro\n");
exit(-1);
}
w_addr = shmat(shmid,0,0);
memset(w_addr,0,sizeof(w_addr));
write(w_addr,argv[1],1024);
exit(0);
&