libhexa/c-example/example.c

26 lines
487 B
C
Raw Normal View History

2024-06-21 01:07:12 +02:00
#include "../libhexa.h"
#include <stdio.h>
#include <string.h>
#define BUFFER_SIZE 2000
int main(void)
{
char buffer[BUFFER_SIZE];
char inp[] = "hello this is me, how are you?";
char title[] = "this is my title";
uint32_t bufsize = BUFFER_SIZE;
uint32_t *bufsizep = &bufsize;
const int ret = hexdump(title, strlen(title), inp, strlen(inp), buffer, bufsizep);
if(ret != 0) {
printf("something bad happened\n");
return 1;
}
printf("%.*s", bufsize, buffer);
return 0;
}