Question : string conversion in C

I have a C program that compiles on gcc and the program has this code:

#define MAX_KEY_LEN 256
unsigned char      key[MAX_KEY_LEN];

The function make_key has this prototype:
int make_key(char *user, char *filename, char *UDN, POINTER key);

The above function is called this way:
nofax_make_key("aaa","bbb","ccc",key);

If I run the program and output the file to a text file using the code:
        char                  teststr[256];
      sprintf(teststr, "echo key:%s > /tmp/kk2/kk1",key);
      system(teststr);

The content of the file is "s+Ç¿¿x9¬¿V¿" (except the colons)
I want to convert the above content to ASCII string.

I have a program that does the conversion:
But I get coredump when I call the C program:
/****************************************************************************
* This routine will encode len binary bytes to ascii according to RFC1113      *
****************************************************************************/
int      bin2ascii(unsigned char *binary, unsigned char *ascii, int len);
unsigned char      key_ascii[10];
encoded_len_key = bin2ascii(key, key_ascii, strlen(key)); /* gives coredump */

How can I get the ASCII equivalent of the string?




Answer : string conversion in C

You can use the Microsoft Key Updater Tool to update the key and it will validate it for you.

http://www.winmatrix.com/forums/index.php?/topic/9539-microsoft-windows-product-key-update-tool/
Random Solutions  
 
programming4us programming4us