Pandu
Pandu

Reputation: 11

Enocde Char string to Octet string?

How do I encode char string to Octet string in C? For example if have:

char *string = "245732473";

I need to encode this string to Octet string? How can i do this?

Upvotes: 1

Views: 1482

Answers (1)

nmichaels
nmichaels

Reputation: 50981

What you have there is, on any modern platform, a string of octets. I noticed that all of your characters are numbers. If you really wanted to convert the numbers represented by the ascii characters there to the numbers you see when you print them out, you should use the atoi function in a for loop.

Upvotes: 1

Related Questions