.TH buffer_init_staticcontents 3 .SH NAME buffer_init_staticcontents \- initialize buffer structure .SH SYNTAX .B #include void \fBbuffer_init_staticcontents\fR(buffer &\fIb\fR, char* \fIy\fR, size_t \fIylen\fR); void \fBbuffer_init_staticcontents_forread\fR(buffer &\fIb\fR, const char* \fIy\fR, size_t \fIylen\fR); .SH DESCRIPTION buffer_init_staticcontents sets up a buffer pointing to a fixed buffer. No file is associated with the buffer. No resizing is done on the buffer. Writing past capacity will return an error. buffer_init_staticcontents_forread sets up a buffer for reading, pointing to a pre-filled fixed buffer. This is useful for writing unit tests. .SH EXAMPLE #include #include #include char buf[4096]; buffer output; char x; buffer_init_staticcontents(&output,buf,sizeof buf); buffer_putsflush(&output,"foo\\nbar\\n"); assert(output.p==8 && byte_equal(buf,8,"foo\\nbar\\n")); .SH "SEE ALSO" buffer_init(3), buffer(3), buffer_init_write(3)