Ok,
So if we consider we are in big endian.
using bit operators I will have:
unsigned char card_number[16];
_int64 badge_id;
..
..
allmsg.card_num ber[0]=(unsigned char) (badge_id & 0x0000000000000 0FF);
allmsg.card_num ber[1]=(unsigned char) ((badge_id >> 8) & 0x000000000000F F);
....
...
...
allmsg.card_num ber[7]=(unsigned char) ((badge_id >> 56) & 0xFF);
So like you can see I can't fit all my array, with an _int64 I can fit only till array [7]. So like you said by using 2 _int64 I will fit the rest of my array like:
S if this way is correct, ok then next step (but in fact first step) is how store the encoded value (for example passed by arguments) this time in 2 variables??
Actually I used this way for 1 variable sure:
So how must I do for 2 variables ? I don't know maybe this way:
is this correct ?
Thank you
So if we consider we are in big endian.
using bit operators I will have:
unsigned char card_number[16];
_int64 badge_id;
..
..
allmsg.card_num ber[0]=(unsigned char) (badge_id & 0x0000000000000 0FF);
allmsg.card_num ber[1]=(unsigned char) ((badge_id >> 8) & 0x000000000000F F);
....
...
...
allmsg.card_num ber[7]=(unsigned char) ((badge_id >> 56) & 0xFF);
allmsg.card_num ber[8]=(unsigned char) (badge_idsecond & 0x0000000000000 0FF);
...
...
allmsg.card_num ber[15]=(unsigned char) ((badge_idsecond >> 128) & 0xFF);
...
...
allmsg.card_num ber[15]=(unsigned char) ((badge_idsecond >> 128) & 0xFF);
Actually I used this way for 1 variable sure:
__int64 badge_id=0;
..
badge_id = atoll(argv[4]);
..
..
badge_id = atoll(argv[4]);
..
__int64 badge_id=0;
__int64 badge_idsecond= 0;
badge_id = atoll((argv[4]) >> 32); //atoll is it right with _int64
badge_idsecond = atoll((argv[4]) >> 64);
__int64 badge_idsecond= 0;
badge_id = atoll((argv[4]) >> 32); //atoll is it right with _int64
badge_idsecond = atoll((argv[4]) >> 64);
is this correct ?
Thank you
Comment