how to convert comma delimited string to unsigned char[]
-
i have a byte array in a string that i read from a resource i used CString for example , i can use any other string types i want to convert a comma delimited byte array string
CString stringarr = "5,10,15,20,25";
to unsigned char[]unsigned char myarray[]={5,10,15,20,25};
i tried some for loop but result is always different than actual data maybe i am doing something wrong with that can you help me please thanks. -
i have a byte array in a string that i read from a resource i used CString for example , i can use any other string types i want to convert a comma delimited byte array string
CString stringarr = "5,10,15,20,25";
to unsigned char[]unsigned char myarray[]={5,10,15,20,25};
i tried some for loop but result is always different than actual data maybe i am doing something wrong with that can you help me please thanks.You should take a look at the strtok_s[^] function. There's even a very similar example as yours.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++ -
i have a byte array in a string that i read from a resource i used CString for example , i can use any other string types i want to convert a comma delimited byte array string
CString stringarr = "5,10,15,20,25";
to unsigned char[]unsigned char myarray[]={5,10,15,20,25};
i tried some for loop but result is always different than actual data maybe i am doing something wrong with that can you help me please thanks.Have also a look at
CString::Tokenize
method [^]. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]