#include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { char *path = argv[1]; int fd; char *buf; int i; int zero = 0; if((fd = open(path, O_RDWR)) < 0){ perror("open"); exit(1); } if((buf = mmap(NULL, PAGE_SIZE, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { perror("mmap"); exit(1); } printf("The str is \"%s\" (%p)\n",buf, buf); }