Go Down

Topic: convert char array to byte array (Read 733 times) previous topic - next topic

pl3g921

Hi,

I need a conversion from a ip adresse like char ip[] = "192,168,2,1" to byte clientreq[]    = { 192,168,  2, 1 };
Can someone help me.
Thanks in advance.
Andreas

PaulS

Quote
I need a conversion from a ip adresse like char ip[] = "192,168,2,1" to byte clientreq[]    = { 192,168,  2, 1 };
Can someone help me.

You could look at the strrok() and atoi() functions.
The art of getting good answers lies in asking good questions.

guix

Hello, you can also use the strtol function, example:
http://codepad.org/i8QgK2Hf

Go Up