Skip to content
/ bytearray Public

Simple and hackable single header library for working with binaries.

License

Notifications You must be signed in to change notification settings

dg4l/bytearray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bytearray.h

Simple and hackable single header library for working with binaries.

Definition of a ByteArray:

typedef struct{
    uint8_t* buf;
    size_t bufsize;
}ByteArray; 

Example of file I/O and error handling:

#include "bytearray/bytearray.h"

int main(void){
    char* filename = "example_file.bin";
    ByteArray* filedata = file_to_byte_array(filename);
    if (!filedata){
        printf("Read Error!\n");
        return -1;
    }
    if (!byte_array_to_file(filedata, filename)){
        printf("Write Error!\n");
        return -1;
    }
    cleanup_bytearray(&filedata);
}

About

Simple and hackable single header library for working with binaries.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages