AminetAminet
Search:
84741 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/c/hexify.lha

Mirror:Random
Showing: m68k-amigaos iconppc-amigaos iconppc-morphos iconi386-aros iconi386-amithlon iconppc-warpup iconppc-powerup icongeneric icon
No screenshot available
Short:Convert binary data into a hex string
Author:Jason Pepas
Uploader:Carsten Larsen (carsten larsen mail com)
Type:dev/c
Version:0.1
Architecture:m68k-amigaos,generic
Date:2020-05-07
Download:dev/c/hexify.lha - View contents
Readme:dev/c/hexify.readme
Downloads:732

About

    Convert binary data (unsigned char*) into a hexidecimal string

Installation

    Copy hexify.h and hexify.c to your source code tree.

API

    int hexify(unsigned char *in, size_t in_size, char *out, size_t out_size);

Example

    #include <stdlib.h>
    #include <stdio.h>
    #include "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 0;
    }

License

    MIT


Contents of dev/c/hexify.lha
PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[unknown]                  448     852  52.6% -lh5- 2800 May  1 12:30 hexify/hexify.c
[unknown]                  351     593  59.2% -lh5- 3a9d May  1 12:30 hexify/hexify.h
[unknown]                  482    1006  47.9% -lh5- 7417 May  1 12:30 hexify/hexify.readme
[unknown]                  635    1079  58.9% -lh5- cd90 May  1 12:30 hexify/LICENSE
[unknown]                  196     282  69.5% -lh5- 82dd May  1 12:30 hexify/Makefile
[unknown]                11037   19120  57.7% -lh5- d07c May  1 12:30 hexify/sample
[unknown]                  309     543  56.9% -lh5- a724 May  1 12:30 hexify/sample.c
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total         7 files   13458   23475  57.3%            May  7 19:05
Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>