GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
buffer_init(3) FreeBSD Library Functions Manual buffer_init(3)

buffer_init - initialize buffer structure

#include <libowfat/buffer.h>

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

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 constants.

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

#include <libowfat/buffer.h> #include <libowfat/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); }

buffer_flush(3), buffer(3)

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.