source: libcf/trunk/test/codec.c@ 66

Last change on this file since 66 was 66, checked in by cheese, 11 years ago

#1 add codec module (bin <-> hex-string)

File size: 808 bytes
Line 
1/**
2 * @file codec.c
3 * @author myusgun <myusgun@gmail.com>
4 */
5#include "cf_codec.h"
6#include "cf_debug.h"
7#include <stdio.h>
8#include <string.h>
9
10int main (void)
11{
12 char data[] =
13 "【 曲名 : 사랑하고 있는데 】\n"
14 "《 歌 : Kylee 》\n"
15 "『 절원의 템페스트 OP2 Theme 』\n";
16
17 char hex[512] = {0x00,};
18 unsigned char bin[512] = {0x00,};
19 size_t length = 0;
20
21 CF_Codec_BinaryToHex ((unsigned char *)data, strlen (data), hex);
22 CF_DEBUG_PRINT (stdout, "data : \n%s\n", data);
23 CF_DEBUG_PRINT (stdout, "hex : \n%s\n\n", hex);
24 CF_DEBUG_PRINT_BIN (stdout, (unsigned char *) data, strlen (data), "data : \n%s", data);
25
26 CF_Codec_HexToBinary (hex, bin, &length);
27 CF_DEBUG_PRINT (stdout, "bin : \n%s\n", bin);
28 CF_DEBUG_PRINT_BIN (stdout, bin, length, "bin : \n%s\n", bin);
29
30 return 0;
31}
Note: See TracBrowser for help on using the repository browser.