A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pepaslabs/hexify.c below:

cellularmitosis/hexify.c: Convert binary data (unsigned char*) into a hexidecimal string

$ clib install pepaslabs/hexify.c
int hexify(unsigned char *in, size_t in_size, char *out, size_t out_size);
cd /tmp
cat > main.c << 'EOF'
#include <stdlib.h>
#include <stdio.h>

#include "hexify/hexify.h"

int main(int argc, char **argv) {
    // pack a binary array
    unsigned char binary[4];
    binary[0] = 0xde;
    binary[1] = 0xad;
    binary[2] = 0xbe;
    binary[3] = 0xef;

    // convert it into a hex string
    char hex[8+1];
    hexify(binary, sizeof(binary), hex, sizeof(hex));

    // print the result
    printf("%s\n", hex);

    return EXIT_SUCCESS;
}
EOF
clib install pepaslabs/hexify.c
gcc -Wall -Werror -c deps/hexify/*.c
gcc -Wall -Werror -Ideps *.o main.c

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4