title: How to use mmap in c
body: <p>I've search and I can't seem to find a way on how to use mmap. This is what I have..</p>
  
  <pre><code>char *pchFile;
  if ((pchFile = (char *) mmap (NULL, fileSize, PROT_READ, MAP_SHARED, fd, 0)) == (char *) -1){
      fprintf(stderr, "Mmap Err: \n");
      exit (1);
  }
  </code></pre>
  
  <p>So, how do I from obtaining pchFile, read from the file? Is pchFile, the array of bytes mapped from mmap? How do I read at an offset like for say 400 bytes? Can I have an offset and read only a certain amount e.g only read 100 bytes?</p>