Home > Back-end >  C implementation of arbitrary string format of IPv6 is converted to an unsigned char array of 16 byt
C implementation of arbitrary string format of IPv6 is converted to an unsigned char array of 16 byt

Time:10-09

Write a program to achieve arbitrary string format IPv6 into an unsigned char array of 16 bytes, for example:
0 x323430393a383031323a38613a393a31303a3a37 into 0 x24098012008a00090010000000000007

CodePudding user response:

I wanted to know so much at the back of you 0 corresponding bin there, and each between digits 0 x3a fixed

CodePudding user response:

I understand is this: 0 x323430393a383031323a38613a393a31303a3a37 into string is 2409:8012-8 a: 9:10: : 7240 9:8012-8 a: 9:10: : 7 into 16 bytes of unsigned char array is 0 x24098012008a00090010000000000007 the result of the final output string

CodePudding user response:

Is four characters, between the obvious: no completion to 0, then, to turn every two byte read in ASCII, ahead of the encounter 0 x3a, check the previous digits, not enough 4 to 0 completion output string, completion

CodePudding user response:

Do with 0 x323430393a383031323a38613a393a31303a3a37 transformation directly, have the sample?

CodePudding user response:

Rule out, just write about yourself, the sample also need to know your original string storage format can be set