>Hello, > >Can any one know how to convert a multibyte char to unsigned long or any type. > >sscanf(char* , format , &destination); will not work... for multibyte..... >even atol(char); will not work... if you have other suggestions please do mail me. > >ex: char[2]; char[0] = 0x23; char[1] = 0x34 , the result should be destination = 0x2334 >should be generic one, the destination need not be always of the same type. > > >Thanks & Regards, >Shrinivas >Dearborn Electronics India >Email: shrinivas@deindia.com >Tel: 91-80-6340404 >Fax: 91-80-6534949 #include <stdio.h> #include <limits.h> int main () { char c[2] = { 0x23, 0x34 }; /* destination should be minimum of 16 bits */ unsigned int d = 0; d = c[0] << CHAR_BIT | c[1]; printf ( "%#x\n", d ); return 0; }