Last change
on this file since 68 was 68, checked in by cheese, 11 years ago |
#1 fix hex codec bug and add codec to windows project
|
File size:
827 bytes
|
Rev | Line | |
---|
[66] | 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 |
|
---|
| 10 | int main (void)
|
---|
| 11 | {
|
---|
[68] | 12 | char data[] = "ONE OK ROCK - Nothing Helps";
|
---|
[66] | 13 |
|
---|
| 14 | char hex[512] = {0x00,};
|
---|
| 15 | unsigned char bin[512] = {0x00,};
|
---|
| 16 | size_t length = 0;
|
---|
| 17 |
|
---|
[68] | 18 | CF_DEBUG_PRINT (stderr, " = Convert binary to hex = \n");
|
---|
[66] | 19 | CF_Codec_BinaryToHex ((unsigned char *)data, strlen (data), hex);
|
---|
[68] | 20 | CF_DEBUG_PRINT (stderr, "data : %s\n", data);
|
---|
| 21 | CF_DEBUG_PRINT (stderr, "hex : %s\n", hex);
|
---|
| 22 | CF_DEBUG_PRINT_BIN (stdout, (unsigned char *) data, strlen (data), "data : %s\n", data);
|
---|
[66] | 23 |
|
---|
[68] | 24 | CF_DEBUG_PRINT (stderr, " = Convert hex to binary = \n");
|
---|
[66] | 25 | CF_Codec_HexToBinary (hex, bin, &length);
|
---|
[68] | 26 | CF_DEBUG_PRINT (stderr, "bin : %s\n", bin);
|
---|
| 27 | CF_DEBUG_PRINT_BIN (stderr, bin, length, "bin : %s\n", bin);
|
---|
[66] | 28 |
|
---|
| 29 | return 0;
|
---|
| 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.