自己写的,先记录一下:#include#include#include#include#include#includestat.h>#includetypes.h>#includeipc.h>#includeshm.h>#define SHM_KEY 0xff110000#define BUFF_SIZE 102400 //100kint main(int argc, char *argv[]){int fs;int fd;int shmid;char *shmptr;int len;char fbuf [BUFF_SIZE];struct stat buf;fs = stat("index.html", &buf;);len = (int) buf.st_size;if(-1 != fs){printf("file length: %d\n", len);}if(-1 !=( fd = open("index.html", O_RDONLY))){read(fd,fbuf, len);}close(fd);if(-1 != (shmid = shmget(SHM_KEY, 0, 0))){if (-1 == shmctl(shmid, IPC_RMID, 0)){printf("delete shm error\n");exit(1);}}if(-1 == (shmid =
...
继续阅读
(29)