c - How to convert an (char) array containing 8 bytes(which represent a 64bit int) to a string -


as written in title, need convert (char) array containing 8 bytes(which represent 64bit int) string. i'm using c code on nec78k0r (16 bit mcu). i'm using iar embedded workbench ide.

my thought or them in 64 bit int type (like f.x long long or int64_t (from stdint.h)), , use sprintf convert string.

however compiler start spitting out errors "the type 'long long' not exist'. whenever use of standard 64bit integer type.

any appreciated.

if char array references memory block of 8 bytes true 64-bit integer, and compiler supports int64_t, can cast , dereference.

int64_t convert(const char* input) {     return *((int64_t*)input); } 

if platform supports 64-bit data types, sprintf support %l format specifier.

if compiles not support any 64-bit data types, you'll need use specific library handle them you, bigint or gmplib.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -