Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
buffer_mmapread(3)	    Library Functions Manual	      buffer_mmapread(3)

NAME
     buffer_mmapread - create read-only memory-mapped file buffer

SYNTAX
     #include <libowfat/buffer.h>

     int buffer_mmapread(buffer &b,const char* filename);

DESCRIPTION
     buffer_mmapread opens filename for reading and fills b so that the contents
     of the file can be read from it.  Using mmap is more efficient than reading
     through  a real buffer, but you have to call buffer_close to unmap the mem-
     ory in the end.

EXAMPLE
       #include <libowfat/buffer.h>
       #include <libowfat/open.h>

       buffer input;
       char x;

       buffer_mmapread(&input,"/etc/passwd");
       while (buffer_get(&input,&x,1)==1) {
	 buffer_put(buffer_1,&x,1);
	 if (x=='\n') break;
       }
       buffer_flush(buffer_1);
       buffer_close(&input);

RETURN VALUE
     buffer_mmapread returns 0 if everything was fine, -1 on error (setting  er-
     rno).

SEE ALSO
     buffer_flush(3), buffer(3)

							      buffer_mmapread(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=libowfat_buffer_mmapread&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help