datatype hexadecimal
Can Anybody help me in converting the string to hex value in OBJECTIVE C
开发者_开发知识库i have to pass the hex value to a macro... i have it in string like ---- 0xfffff how can i convert this string to hex and in what data type....
Use -[NSScanner scanHexLongLong:]
:
NSString * s = @"0xFFFFF";
unsigned long long ull = 0;
NSScanner * scanner = [NSScanner scannerWithString:s];
[scanner scanHexLongLong:&ull];
NSLog(@"%llu", ull); //logs 1048575
精彩评论