Treat file as a block of memory in C

Is there a way to get pointers to read a file as a block of memory in C? Can file access be faster ...?

+4
source share
1 answer

Processing a file as memory (and allowing the OS to make an IO file for you) is called memory mapping .

On POSIX (like Linux ), the mmap() function does this.

On Windows , the OpenFileMapping() function and friends do this. Microsoft has a great description of how this works, why use it, and details on their platform here .

+5
source

Source: https://habr.com/ru/post/1345507/


All Articles