Skip to content

uldza/buf.c

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

buf.c

Simple byte buffers

Example

#include <stdio.h>
#include "buf.h"

int main() {
    struct buf buf = { 0 };
    buf_append(&buf, "hello", 5);    // append data
    buf_append(&buf, " world", -1);  // append c-string
    buf_append_byte(&buf, '!');      // append single byte

    printf("%s\n", buf.data);

    buf_clear(&buf);                 // clear and free the buffer
}
// output:
// hello world!

About

simple byte buffers

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 100.0%