Updating a file random access in c
Both types of files have advantages and disadvantages.
If you are always accessing information in the same order, a sequential-access file is faster.
We can use the pointer to jump to a specific byte to access the data.
The example given in part 1 illustrates this by reading a specific byte you specify. mmap is then applied to map the entire file into memory.
If we define as int, then we can access the data as ints.
Multiple views may also be necessary if the file is greater than the size of the application’s logical memory space available for memory mapping (2 GB on a 32-bit computer). Otherwise, it returns a value of MAP_FAILED and sets errno.