buffer_init man page on Alpinelinux

Man page or keyword search:  
man Server   18016 pages
apropos Keyword Search (all sections)
Output format
Alpinelinux logo
[printable version]

buffer_init(3)							buffer_init(3)

NAME
       buffer_init - initialize buffer structure

SYNTAX
       #include <buffer.h>

       void buffer_init(buffer &b,
		       ssize_t (*op)(int,char*,size_t),
		       int fd, char* y, size_t ylen);

DESCRIPTION
       buffer_init prepares b to store a string in y[0], y[1], ..., y[ylen-1].
       Initially the string is empty.

       buffer_init also prepares b to use the read/write  operation  specified
       by op and fd.

       You can use

	 buffer b = BUFFER_INIT(op,fd,y,ylen);

       to initialize b statically if op, fd, y, and ylen are compile-time con‐
       stants.

       You can call buffer_init again at any time. Note that this discards the
       currently buffered string.

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

	 char buf[4096];
	 int fd=open_read("/etc/services");
	 buffer input;

	 if (fd>=0) {
	   char x;
	   buffer_init(&input,read,fd,buf,sizeof buf);
	   while (buffer_get(&input,&x,1)==1) {
	     buffer_put(buffer_1,&x,1);
	     if (x=='\n') break;
	   }
	   buffer_flush(buffer_1);
	 }

SEE ALSO
       buffer_flush(3), buffer(3)

								buffer_init(3)
[top]

List of man pages available for Alpinelinux

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net