Convert "unsigned char[8]" to long
-
How do i convert a "unsigned char[8]" 8 byte array to a long. Please help. Many thnx in advance.
Does this example help??? Found it on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_atof.2c_.atoi.2c_._atoi64.2c_.atol.asp[^] char *s; long l; s = "98854 dollars"; /* Test of atol */ l = atol( s ); printf( "atol test: \"%s\"; long: %ld\n", s, l ); Output atol test: "98854 dollars"; long: 98854
-
Does this example help??? Found it on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_atof.2c_.atoi.2c_._atoi64.2c_.atol.asp[^] char *s; long l; s = "98854 dollars"; /* Test of atol */ l = atol( s ); printf( "atol test: \"%s\"; long: %ld\n", s, l ); Output atol test: "98854 dollars"; long: 98854
thnx for the reply, but that's not exactly what i'm looking for. I solved it by using a union. union x { unsigned char[8] ucaByteArray; double d; }; Because it's a union, they share the same address space, which means the content of all the 8 element can be accessed directly by the double. This is precisely what i want, and it works great.