#include #include #include #include #include int main(){ int fd = open("file_to_mmap.c", O_RDWR); char *file_data = mmap(0, 1024, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); puts(file_data); int sheep_count = 0; char *sheep_spot = file_data; while(sheep_spot = strstr(sheep_spot, "sheep")){ sheep_spot[0] = ' '; sheep_spot[1] = 'j'; sheep_count++; } printf("Found the word sheep %d times\n", sheep_count); munmap(file_data, 1024); close(fd); return 0; }