The mmap() is system call (or a function) is used for mapping between a process address space and either files or devices. When a file is mapped to a process address space, the file can be accessed like an array in the program.
This is one of the most efficient ways to access data in the file and provides a seamless coding interface that is natural for a data structure that can be assessed without he abstraction of reading and writing from files Below is syntax for the same,
This is one of the most efficient ways to access data in the file and provides a seamless coding interface that is natural for a data structure that can be assessed without he abstraction of reading and writing from files Below is syntax for the same,
#include <sys/mman.h>
void * mmap(void *address, size_t length, int protect, int flags, int fields, off_t offset);
On success -returns 0; on failure - returns -1.
On success -returns 0; on failure - returns -1.
Note:- mmap() is a powerful system call, but it may lead portability issues because this function is only supported by the Linux environment.
Don't forgot to unmap after usage.