ProAnswers.org

How to extract values from CHAR ARRAY?

Use the sscanf function,

See following char array in C,

char array[1024] = “My Message: 0x7ffff6be9600”

 To extract the value "0x7ffff6be9600" only from above char array.



Try this one:



unsigned long l;  



if (3 == sscanf(array, "%*s %*s %lx", &l)) //ignore the words before the number.



I hope this will help you!!