473,625 Members | 2,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how pass an __int64 to unsigned char [16]

16 New Member
Hi,

I have a struct "allmsg" and him member :
Expand|Select|Wrap|Line Numbers
  1.  unsigned char card_number[MAX_CARD_NUMBER]; //16
  2.  
allmsg.card_num ber


And I must store contain of an __int64 into this member

Expand|Select|Wrap|Line Numbers
  1.     __int64 temp_badge_id;
  2.     unsigned char *ptemp_badge_id; //
  3.  

So I pass value to this last :

Expand|Select|Wrap|Line Numbers
  1.  
  2. DLL_API(long) vgt_sendto_S3100(__int64 badgeid, char* remote_host, int remote_port)
  3. {
  4.                         //allmsg.card_number=(unsigned char*)badgeid; //ERROR
  5.  
  6.     unsigned int crc32=0;
  7.                         temp_badge_id = badgeid; //here passing value OK
  8.  
  9.  

And the code above here: seems ok but the contains of allmsg.cardnumb er
is not the exactly the same than the _int64
Expand|Select|Wrap|Line Numbers
  1.  
  2. allmsg.card_number[15]=ptemp_badge_id[15];  //not good way
  3. allmsg.card_number[14]=ptemp_badge_id[14];
  4. ....
  5. ...
  6. allmsg.card_number[0]=ptemp_badge_id[0];
  7.  
  8.  
It seems ok till 8 first bytes and then contains is not good.
So maybe _int64 must be casted differently to pass in unsigned char ?

And in fact _int64 is 8 bytes and not 16 bytes where it must store?



Here above codes to check for details:

I have a struct define in S3100.h :

Expand|Select|Wrap|Line Numbers
  1.  
  2. #define MAX_CARD_NUMBER 16
  3. #define MAX_PADDING 16
  4.  
  5. #define CRC_LENGTH 36
  6. #define CRC_LENGTH_RETURN 16
  7.  
  8. struct frame_message { 
  9. unsigned int sender_id;
  10.                           ..
  11. unsigned char card_number[MAX_CARD_NUMBER];//crcin
  12.                         ..
  13. unsigned char padding_bytes[MAX_PADDING];
  14. }allmsg; 
  15.  
  16. ..
  17.  
  18. unsigned char *ps_card_number;
  19.  
  20. ..
  21.  
  22.  
in the other file S3100.cpp (dll) , I have this :
Expand|Select|Wrap|Line Numbers
  1.  
  2. #include "S3100.h"
  3.  
  4. ..
  5. #define PACKET_LENGTH 68 //with padding bytes reserved
  6.  
  7. #define CRC_LENGTH 36
  8.  
  9. .........
  10. .........
  11. ////IMPLEMENTATION CRC CLASS/////
  12.  =======================================================================================
  13.                         // Fonction: Crc32::Crc32()
  14.                         // =======================================================================================
  15.  
  16.                         Crc32::Crc32()
  17.                         {
  18.                             memset( &this->crc32_table, 0, sizeof(unsigned int)*256 );
  19.                             this->polynomial = 0;
  20.                         }        
  21.                         // =======================================================================================
  22.  
  23.                         ........
  24.                         ........
  25.  
  26.                         //VARIABLES GENERALES ////
  27.                         long error_code=0;        
  28.                         bool DEBUG=true;
  29.                         bool initcrcok=false;
  30.                         unsigned int rescrc32=0;
  31.                         char msg_crc[CRC_LENGTH];        // message to send
  32.  
  33.                         char message[MAX_PATH];            // message to send
  34.                         //char response[MAX_PATH];        // response to receive  //090406
  35.                         char* response = (char*)malloc(1024*sizeof(char));  
  36.                         int message_length=68;            // length of the message to send
  37.                         int response_length=0;            
  38.                         int engine_id=0;                
  39.                         int analyse_id=0;    
  40.                         //int remote_port=0;    
  41.                         int timeout_ms=1000;            
  42.  
  43.                         char binary[80];
  44.  
  45.  
  46.                         char *glremote_ip=NULL;
  47.                         int glremote_port;
  48.  
  49.                         bool init_struct=false;
  50.  
  51.                         frame_message packet;
  52.                         Crc32 *pCrc32 = new Crc32();
  53.  
  54.                         __int64 temp_badge_id;
  55.                         char *ptemp_badge_id; //090408 enlever le unsigned
  56.  
  57.                         .......
  58.                         .......
  59.  
  60.  
  61.                         void init_structptr()
  62.                         {
  63.  
  64.                             memset(allmsg.card_number,0,MAX_CARD_NUMBER);
  65.                             memset(allmsg.padding_bytes,0,MAX_PADDING);
  66.  
  67.                             memset(message,0,MAX_PATH);
  68.                             message_length=0;
  69.                             memset(msg_crc,0,CRC_LENGTH);//crc
  70.  
  71.                             memset(response,0,MAX_PATH); //090406
  72.  
  73.                             psender_id = (unsigned char*)&(allmsg.sender_id);
  74.                             pencrypt_key_id = (unsigned char*)&allmsg.encrypt_key_id;
  75.                             pencrypt_size = (unsigned char*)&allmsg.encrypt_size;
  76.                             pcrc = (unsigned char*)&allmsg.crc;
  77.                             pdata_length = (unsigned char*)&allmsg.data_length;//crcin
  78.                             psequence_number = (unsigned char*)&allmsg.sequence_number;//crcin
  79.                             ppacket_type = (unsigned char*)&allmsg.packet_type;//crcin
  80.                             ps_read_number = (unsigned char*)&allmsg.read_number;//crcin
  81.                             ps_card_number = (unsigned char*)&allmsg.card_number; //crcin
  82.                             ps_pin_code = (unsigned char*)&allmsg.pin_code; //crcin
  83.                             ppadding_bytes = (unsigned char*)&allmsg.padding_bytes;
  84.  
  85.                             //allmsg.sender_id=0x0a0b0c0d;  //hexadecimal sur 4 bytes rmq: nous sommes en little endian
  86.                             //allmsg.sender_id=3;
  87.                             allmsg.sender_id=0;
  88.                             allmsg.encrypt_key_id=0;
  89.                             //allmsg.encrypt_size=0;
  90.                             allmsg.encrypt_size=40;
  91.                             allmsg.crc=0; //090406
  92.                             //allmsg.data_length=24; //crcin 1
  93.                             allmsg.data_length=52; //crcin 1
  94.                             //allmsg.sequence_number=12345; //crcin 2
  95.                             //allmsg.sequence_number=1; //090407 géré en mode saisie clavier
  96.                             allmsg.packet_type=1; //crcin 3
  97.                             //allmsg.read_number=2; //crcin 4 //090401
  98.                             //allmsg.read_number=1; //090407 géré en mode saisie clavier
  99.                             allmsg.pin_code=0; //crcin 6 //090404
  100.  
  101.                             alreadyinit =true;
  102.                             //allmsg.card_number=0;//0904007
  103.  
  104.                         ptemp_badge_id = (char*)&temp_badge_id; //090407
  105.  
  106.                         }
  107.  
  108.                         ......
  109.                         ......
  110.                         void write_struct(bool a)
  111.                         {
  112.  
  113.                             if (a)
  114.                             {    
  115.                         #ifdef _LITTLE_ENDIAN
  116.                                 message[0]= psender_id[0];
  117.                                 message[1]= psender_id[1]; 
  118.                                 message[2]= psender_id[2]; 
  119.                                 message[3]= psender_id[3];    
  120.  
  121.                                 message[4]= pencrypt_key_id[0];
  122.                                 message[5]= pencrypt_key_id[1]; 
  123.                                 message[6]= pencrypt_key_id[2]; 
  124.                                 message[7]= pencrypt_key_id[3];
  125.  
  126.                                 message[8]= pencrypt_size[0];
  127.                                 message[9]= pencrypt_size[1]; 
  128.                                 message[10]= pencrypt_size[2]; 
  129.                                 message[11]= pencrypt_size[3];
  130.                                 ///        
  131.                                 message[12]= pcrc[0];
  132.                                 message[13]= pcrc[1]; 
  133.                                 message[14]= pcrc[2]; 
  134.                                 message[15]= pcrc[3];
  135.                                 ///
  136.                                 message[16]= pdata_length[0];
  137.                                 message[17]= pdata_length[1]; 
  138.                                 message[18]= pdata_length[2]; 
  139.                                 message[19]= pdata_length[3];
  140.                                 msg_crc[0]=pdata_length[0];///////crc 1
  141.                                 msg_crc[1]=pdata_length[1];
  142.                                 msg_crc[2]=pdata_length[2];
  143.                                 msg_crc[3]=pdata_length[3];
  144.  
  145.                                 message[20]= psequence_number[0];
  146.                                 message[21]= psequence_number[1]; 
  147.                                 message[22]= psequence_number[2]; 
  148.                                 message[23]= psequence_number[3];
  149.                                 msg_crc[4]=psequence_number[0];///////crc 2
  150.                                 msg_crc[5]=psequence_number[1];
  151.                                 msg_crc[6]=psequence_number[2];
  152.                                 msg_crc[7]=psequence_number[3];
  153.  
  154.                                 message[24]= ppacket_type[0];
  155.                                 message[25]= ppacket_type[1]; 
  156.                                 message[26]= ppacket_type[2]; 
  157.                                 message[27]= ppacket_type[3];
  158.                                 msg_crc[8]=ppacket_type[0];///////crc 3
  159.                                 msg_crc[9]=ppacket_type[1];
  160.                                 msg_crc[10]=ppacket_type[2];
  161.                                 msg_crc[11]=ppacket_type[3];
  162.  
  163.                                 message[28]= ps_read_number[0];
  164.                                 message[29]= ps_read_number[1]; 
  165.                                 message[30]= ps_read_number[2]; 
  166.                                 message[31]= ps_read_number[3];
  167.                                 msg_crc[12]=ps_read_number[0]; ///////crc 4
  168.                                 msg_crc[13]=ps_read_number[1];
  169.                                 msg_crc[14]=ps_read_number[2];
  170.                                 msg_crc[15]=ps_read_number[3];
  171.  
  172.                                 for (int i=0; i<16 ;++i )
  173.                                 {
  174.                                 msg_crc[16+i]=message[32+i]= ps_card_number[i]; //crc 5
  175.                                 }/*
  176.                                 msg_crc[16]=message[32]= ps_card_number[0]; //crc 5
  177.                                 msg_crc[17]=message[33]= ps_card_number[1]; 
  178.                                 msg_crc[18]=message[34]= ps_card_number[2]; 
  179.                                 msg_crc[19]=message[35]= ps_card_number[3];
  180.                                 msg_crc[20]=message[36]= ps_card_number[4];
  181.                                 msg_crc[21]=message[37]= ps_card_number[5]; 
  182.                                 msg_crc[22]=message[38]= ps_card_number[6]; 
  183.                                 msg_crc[23]=message[39]= ps_card_number[7];
  184.                                 msg_crc[24]=message[40]= ps_card_number[8];
  185.                                 msg_crc[25]=message[41]= ps_card_number[9]; 
  186.                                 msg_crc[26]=message[42]= ps_card_number[10]; 
  187.                                 msg_crc[27]=message[43]= ps_card_number[11];
  188.                                 msg_crc[28]=message[44]= ps_card_number[12];
  189.                                 msg_crc[29]=message[45]= ps_card_number[13]; 
  190.                                 msg_crc[30]=message[46]= ps_card_number[14]; 
  191.                                 msg_crc[31]=message[47]= ps_card_number[15];
  192.                                 */
  193.  
  194.                                 msg_crc[32]=message[48]= ps_pin_code[0]; //crc 6
  195.                                 msg_crc[33]=message[49]= ps_pin_code[1];
  196.                                 msg_crc[34]=message[50]= ps_pin_code[2];
  197.                                 msg_crc[35]=message[51]= ps_pin_code[3]; 
  198.  
  199.                                 for (int i=0; i<16 ;++i )
  200.                                 {
  201.                                 message[52+i]= ppadding_bytes[i];
  202.                                 }/*
  203.                                 message[52]= ppadding_bytes[0];
  204.                                 message[53]= ppadding_bytes[1]; 
  205.                                 message[54]= ppadding_bytes[2]; 
  206.                                 message[55]= ppadding_bytes[3];
  207.                                 message[56]= ppadding_bytes[4];
  208.                                 message[57]= ppadding_bytes[5]; 
  209.                                 message[58]= ppadding_bytes[6]; 
  210.                                 message[59]= ppadding_bytes[7];
  211.                                 message[60]= ppadding_bytes[8];
  212.                                 message[61]= ppadding_bytes[9]; 
  213.                                 message[62]= ppadding_bytes[10]; 
  214.                                 message[63]= ppadding_bytes[11];
  215.                                 message[64]= ppadding_bytes[12];
  216.                                 message[65]= ppadding_bytes[13]; 
  217.                                 message[66]= ppadding_bytes[14]; 
  218.                                 message[67]= ppadding_bytes[15];
  219.                                 */
  220.  
  221.                         #else
  222.                                 message[0]= psender_id[3];
  223.                                 message[1]= psender_id[2]; 
  224.                                 message[2]= psender_id[1]; 
  225.                                 message[3]= psender_id[0];    
  226.  
  227.                                 message[4]= pencrypt_key_id[3];
  228.                                 message[5]= pencrypt_key_id[2]; 
  229.                                 message[6]= pencrypt_key_id[1]; 
  230.                                 message[7]= pencrypt_key_id[0];
  231.  
  232.                                 message[8]= pencrypt_size[3];
  233.                                 message[9]= pencrypt_size[2]; 
  234.                                 message[10]= pencrypt_size[1]; 
  235.                                 message[11]= pencrypt_size[0];
  236.                                 ///        
  237.                                 message[12]= pcrc[3];
  238.                                 message[13]= pcrc[2]; 
  239.                                 message[14]= pcrc[1]; 
  240.                                 message[15]= pcrc[0];
  241.                                 ///
  242.                                 message[16]= pdata_length[3];
  243.                                 message[17]= pdata_length[2]; 
  244.                                 message[18]= pdata_length[1]; 
  245.                                 message[19]= pdata_length[0];
  246.                                 msg_crc[0]=pdata_length[3];///////crc 1
  247.                                 msg_crc[1]=pdata_length[2];
  248.                                 msg_crc[2]=pdata_length[1];
  249.                                 msg_crc[3]=pdata_length[0];
  250.  
  251.                                 //printf("\nblabla Big_endian\n");
  252.  
  253.                                 message[20]= psequence_number[3];
  254.                                 message[21]= psequence_number[2]; 
  255.                                 message[22]= psequence_number[1]; 
  256.                                 message[23]= psequence_number[0];
  257.                                 msg_crc[4]=psequence_number[3];///////crc 2
  258.                                 msg_crc[5]=psequence_number[2];
  259.                                 msg_crc[6]=psequence_number[1];
  260.                                 msg_crc[7]=psequence_number[0];
  261.  
  262.                                 message[24]= ppacket_type[3];
  263.                                 message[25]= ppacket_type[2]; 
  264.                                 message[26]= ppacket_type[1]; 
  265.                                 message[27]= ppacket_type[0];
  266.                                 msg_crc[8]=ppacket_type[3];///////crc 3
  267.                                 msg_crc[9]=ppacket_type[2];
  268.                                 msg_crc[10]=ppacket_type[1];
  269.                                 msg_crc[11]=ppacket_type[0];
  270.  
  271.                                 message[28]= ps_read_number[3];
  272.                                 message[29]= ps_read_number[2]; 
  273.                                 message[30]= ps_read_number[1]; 
  274.                                 message[31]= ps_read_number[0];
  275.                                 msg_crc[12]=ps_read_number[3]; ///////crc 4
  276.                                 msg_crc[13]=ps_read_number[2];
  277.                                 msg_crc[14]=ps_read_number[1];
  278.                                 msg_crc[15]=ps_read_number[0];
  279.  
  280.  
  281.                                 message[32]= ps_card_number[15];
  282.                                 message[33]= ps_card_number[14]; 
  283.                                 message[34]= ps_card_number[13]; 
  284.                                 message[35]= ps_card_number[12];
  285.                                 message[36]= ps_card_number[11];
  286.                                 message[37]= ps_card_number[10]; 
  287.                                 message[38]= ps_card_number[9]; 
  288.                                 message[39]= ps_card_number[8];
  289.                                 message[40]= ps_card_number[7];
  290.                                 message[41]= ps_card_number[6]; 
  291.                                 message[42]= ps_card_number[5]; 
  292.                                 message[43]= ps_card_number[4];
  293.                                 message[44]= ps_card_number[3];
  294.                                 message[45]= ps_card_number[2]; 
  295.                                 message[46]= ps_card_number[1]; 
  296.                                 message[47]= ps_card_number[0];
  297.                                 msg_crc[16]= ps_card_number[15]; //crc 5
  298.                                 msg_crc[17]= ps_card_number[14]; 
  299.                                 msg_crc[18]= ps_card_number[13]; 
  300.                                 msg_crc[19]= ps_card_number[12];
  301.                                 msg_crc[20]= ps_card_number[11];
  302.                                 msg_crc[21]= ps_card_number[10]; 
  303.                                 msg_crc[22]= ps_card_number[9]; 
  304.                                 msg_crc[23]= ps_card_number[8];
  305.                                 msg_crc[24]= ps_card_number[7];
  306.                                 msg_crc[25]= ps_card_number[6]; 
  307.                                 msg_crc[26]= ps_card_number[5]; 
  308.                                 msg_crc[27]= ps_card_number[4];
  309.                                 msg_crc[28]= ps_card_number[3];
  310.                                 msg_crc[29]= ps_card_number[2]; 
  311.                                 msg_crc[30]= ps_card_number[1]; 
  312.                                 msg_crc[31]= ps_card_number[0];
  313.  
  314.                                 message[48]= ps_pin_code[3]; 
  315.                                 message[49]= ps_pin_code[2];
  316.                                 message[50]= ps_pin_code[1];
  317.                                 message[51]= ps_pin_code[0];                 
  318.                                 msg_crc[32]=ps_pin_code[3]; //crc 6
  319.                                 msg_crc[33]=ps_pin_code[2];
  320.                                 msg_crc[34]=ps_pin_code[1];
  321.                                 msg_crc[35]=ps_pin_code[0]; 
  322.  
  323.                                 message[52]= ppadding_bytes[15];
  324.                                 message[53]= ppadding_bytes[14]; 
  325.                                 message[54]= ppadding_bytes[13]; 
  326.                                 message[55]= ppadding_bytes[12];
  327.                                 message[56]= ppadding_bytes[11];
  328.                                 message[57]= ppadding_bytes[10]; 
  329.                                 message[58]= ppadding_bytes[9]; 
  330.                                 message[59]= ppadding_bytes[8];
  331.                                 message[60]= ppadding_bytes[7];
  332.                                 message[61]= ppadding_bytes[6]; 
  333.                                 message[62]= ppadding_bytes[5]; 
  334.                                 message[63]= ppadding_bytes[4];
  335.                                 message[64]= ppadding_bytes[3];
  336.                                 message[65]= ppadding_bytes[2]; 
  337.                                 message[66]= ppadding_bytes[1]; 
  338.                                 message[67]= ppadding_bytes[0];
  339.                         #endif
  340.                             } // if(a)
  341.                             else
  342.                             {
  343.                         #ifdef _LITTLE_ENDIAN
  344.  
  345.                                 message[12]= pcrc[0];
  346.                                 message[13]= pcrc[1]; 
  347.                                 message[14]= pcrc[2]; 
  348.                                 message[15]= pcrc[3];
  349.  
  350.                                 message[32]= ps_card_number[0];
  351.                                 message[33]= ps_card_number[1]; 
  352.                                 message[34]= ps_card_number[2]; 
  353.                                 message[35]= ps_card_number[3];
  354.                                 message[36]= ps_card_number[4];
  355.                                 message[37]= ps_card_number[5]; 
  356.                                 message[38]= ps_card_number[6]; 
  357.                                 message[39]= ps_card_number[7];
  358.                                 message[40]= ps_card_number[8];
  359.                                 message[41]= ps_card_number[9]; 
  360.                                 message[42]= ps_card_number[10]; 
  361.                                 message[43]= ps_card_number[11];
  362.                                 message[44]= ps_card_number[12];
  363.                                 message[45]= ps_card_number[13]; 
  364.                                 message[46]= ps_card_number[14]; 
  365.                                 message[47]= ps_card_number[15];
  366.  
  367.                             #else
  368.  
  369.                                 message[32]= ps_card_number[15];
  370.                                 message[33]= ps_card_number[14]; 
  371.                                 message[34]= ps_card_number[13]; 
  372.                                 message[35]= ps_card_number[12];
  373.                                 message[36]= ps_card_number[11];
  374.                                 message[37]= ps_card_number[10]; 
  375.                                 message[38]= ps_card_number[9]; 
  376.                                 message[39]= ps_card_number[8];
  377.                                 message[40]= ps_card_number[7];
  378.                                 message[41]= ps_card_number[6]; 
  379.                                 message[42]= ps_card_number[5]; 
  380.                                 message[43]= ps_card_number[4];
  381.                                 message[44]= ps_card_number[3];
  382.                                 message[45]= ps_card_number[2]; 
  383.                                 message[46]= ps_card_number[1]; 
  384.                                 message[47]= ps_card_number[0];
  385.  
  386.                                 message[12]= pcrc[3]; //GOOD
  387.                                 message[13]= pcrc[2]; 
  388.                                 message[14]= pcrc[1]; 
  389.                                 message[15]= pcrc[0];
  390.  
  391.                             #endif
  392.  
  393.                             }
  394.                         }
  395.  
  396.                         .....
  397.                         .....
  398.  
  399.                         DLL_API(long) vgt_init_S3100 ( char* remote_host, int remote_port, int active_door, int seq_number)
  400.                         {
  401.  
  402.                             if (!alreadyinit)  
  403.                             init_structptr();
  404.  
  405.                             glremote_ip=remote_host;  //090407 ATTENTION APRES INIT
  406.                             glremote_port =remote_port;
  407.                             allmsg.read_number = active_door;    
  408.                             allmsg.sequence_number=seq_number;
  409.                             write_struct(1);
  410.                             init_struct =true;
  411.  
  412.                             return 0 ;
  413.                         }
  414.  
  415.  
  416.                         .....
  417.                         .....
  418.  
  419.  
  420.  
  421.                         DLL_API(long) vgt_sendto_S3100    (__int64 badgeid, char* remote_host, int remote_port)
  422.                         {
  423.                         //allmsg.card_number=(unsigned char*)&badgeid;
  424.                         //ps_card_number=(unsigned char*)badge_id;
  425.                         unsigned int crc32=0;
  426.                         temp_badge_id = badgeid;
  427.                         memset(message,0,MAX_PATH);
  428.                         //message[32]= ps_card_number[15];
  429.  
  430.  
  431.                         //allmsg.card_number=(unsigned char*)&temp_badge_id;
  432.  
  433.  
  434.                                 allmsg.card_number[15]=ptemp_badge_id[15];  //ICIBUG
  435.                                 allmsg.card_number[14]=ptemp_badge_id[14];
  436.                                 allmsg.card_number[13]=ptemp_badge_id[13]; 
  437.                                 allmsg.card_number[12]=ptemp_badge_id[12];
  438.                                 allmsg.card_number[11]=ptemp_badge_id[11];
  439.                                 allmsg.card_number[10]=ptemp_badge_id[10]; 
  440.                                 allmsg.card_number[9]=ptemp_badge_id[9]; 
  441.                                 allmsg.card_number[8]=ptemp_badge_id[8];
  442.                                 allmsg.card_number[7]=ptemp_badge_id[7];
  443.                                 allmsg.card_number[6]=ptemp_badge_id[6]; 
  444.                                 allmsg.card_number[5]=ptemp_badge_id[5]; 
  445.                                 allmsg.card_number[4]=ptemp_badge_id[4];
  446.                                 allmsg.card_number[3]=ptemp_badge_id[3];
  447.                                 allmsg.card_number[2]=ptemp_badge_id[2]; 
  448.                                 allmsg.card_number[1]=ptemp_badge_id[1]; 
  449.                                 allmsg.card_number[0]=ptemp_badge_id[0];
  450.  
  451.  
  452.                         /*
  453.                          char digits[30];
  454.                          sprintf(digits,"%I64d\n",temp_badge_id);
  455.                         //I64d
  456.                         for(int i=0; i<20; i++)
  457.  
  458.                         printf ("digits[%d] = %d ", i, digits[i]);
  459.  
  460.                         //allmsg.card_number=(unsigned char*)&digits;
  461.                                 allmsg.card_number[15]=digits[15];  //ICIBUG
  462.                                 allmsg.card_number[14]=digits[14];
  463.                                 allmsg.card_number[13]=digits[13]; 
  464.                                 allmsg.card_number[12]=digits[12];
  465.                                 allmsg.card_number[11]=digits[11];
  466.                                 allmsg.card_number[10]=digits[10]; 
  467.                                 allmsg.card_number[9]=digits[9]; 
  468.                                 allmsg.card_number[8]=digits[8];
  469.                                 allmsg.card_number[7]=digits[7];
  470.                                 allmsg.card_number[6]=digits[6]; 
  471.                                 allmsg.card_number[5]=digits[5]; 
  472.                                 allmsg.card_number[4]=digits[4];
  473.                                 allmsg.card_number[3]=digits[3];
  474.                                 allmsg.card_number[2]=digits[2]; 
  475.                                 allmsg.card_number[1]=digits[1]; 
  476.                                 allmsg.card_number[0]=digits[0];
  477.                         */
  478.  
  479.  
  480.                         printf("\nvaleur de temp_badge_id (Lu)= %Lu\n", temp_badge_id);
  481.  
  482.                         printf("\nvaleur de *ptemp_badge_id apres  (s)= %s\n", (unsigned char*)ptemp_badge_id);
  483.  
  484.                         printf("\nvaleur de *ptemp_badge_id apres (c) = %c\n");
  485.                         for (int i=0;i<16;++i)
  486.                         {
  487.                         printf("%c, ", (unsigned char*)ptemp_badge_id[i]);
  488.                         }
  489.                         printf("\n");
  490.                         //gbadge_id = badgeid;
  491.                         //allmsg.card_number= badgeid;
  492.  
  493.                         //allmsg.card_number=(unsigned char*)&temp_badge_id;
  494.                         /*
  495.                                         allmsg.card_number[0]=(((unsigned char)&badgeid) & 0x00000000000000FF); //GOOD TOO
  496.                                         allmsg.card_number[1]= (unsigned char)(&badgeid & 0x000000000000FF); //GOOD TOO
  497.                                         allmsg.card_number[2]= (unsigned char)(&badgeid & 0x0000000000FF); //GOOD TOO
  498.                                         allmsg.card_number[3]= (unsigned char)(&badgeid & 0x00000000FF); //GOOD TOO
  499.                                         allmsg.card_number[4]= (unsigned char)(&badgeid & 0x000000FF); //GOOD TOO
  500.                                         allmsg.card_number[5]= (unsigned char)(&badgeid & 0x0000FF); //GOOD TOO
  501.                                         allmsg.card_number[6]= (unsigned char)(&badgeid & 0x00FF); //GOOD TOO
  502.                                         allmsg.card_number[7]= (unsigned char)(&badgeid & 0xFF); //GOOD TOO
  503.                         */
  504.  
  505.                         //temp_badge_id  =(__int64)&badgeid;
  506.  
  507.                         //ptemp_badge_id = __ui64toa( badgeid, temparray, 10 );
  508.  
  509.                         //ptemp_badge_id=(unsigned char*)&temp_badge_id;
  510.  
  511.                         //allmsg.card_number[0]=&temp_badge_id
  512.  
  513.  
  514.                         //if (!alreadyinit)
  515.                         //init_structptr();
  516.  
  517.                         ////////////////////////////:
  518.  
  519.                         /*
  520.                             message[32]= ps_card_number[15];
  521.                             message[33]= ps_card_number[14]; 
  522.                             message[34]= ps_card_number[13]; 
  523.                             message[35]= ps_card_number[12];
  524.                             message[36]= ps_card_number[11];
  525.                             message[37]= ps_card_number[10]; 
  526.                             message[38]= ps_card_number[9]; 
  527.                             message[39]= ps_card_number[8];
  528.                             message[40]= ps_card_number[7];
  529.                             message[41]= ps_card_number[6]; 
  530.                             message[42]= ps_card_number[5]; 
  531.                             message[43]= ps_card_number[4];
  532.                             message[44]= ps_card_number[3];
  533.                             message[45]= ps_card_number[2]; 
  534.                             message[46]= ps_card_number[1]; 
  535.                             message[47]= ps_card_number[0];
  536.                         */
  537.  
  538.                         //allmsg.card_number= (unsigned char*)&badgeid;
  539.  
  540.                         /*
  541.                                 allmsg.card_number[15]=ptemp_badge_id[15];  //ICIBUG
  542.                                 allmsg.card_number[14]=ptemp_badge_id[14];
  543.                                 allmsg.card_number[13]=ptemp_badge_id[13]; 
  544.                                 allmsg.card_number[12]=ptemp_badge_id[12];
  545.                                 allmsg.card_number[11]=ptemp_badge_id[11];
  546.                                 allmsg.card_number[10]=ptemp_badge_id[10]; 
  547.                                 allmsg.card_number[9]=ptemp_badge_id[9]; 
  548.                                 allmsg.card_number[8]=ptemp_badge_id[8];
  549.                                 allmsg.card_number[7]=ptemp_badge_id[7];
  550.                                 allmsg.card_number[6]=ptemp_badge_id[6]; 
  551.                                 allmsg.card_number[5]=ptemp_badge_id[5]; 
  552.                                 allmsg.card_number[4]=ptemp_badge_id[4];
  553.                                 allmsg.card_number[3]=ptemp_badge_id[3];
  554.                                 allmsg.card_number[2]=ptemp_badge_id[2]; 
  555.                                 allmsg.card_number[1]=ptemp_badge_id[1]; 
  556.                                 allmsg.card_number[0]=ptemp_badge_id[0];
  557.                         */
  558.  
  559.  
  560.                         memset(message,0,MAX_PATH);
  561.                         write_struct(1);   //090406 (1) -> (0) -> 1 ok // plus bas
  562.  
  563.                         initcrcok =0 ;
  564.                         initcrcok = objcrc32.Init(CRC32_POLY_WINZIP);
  565.  
  566.                         rescrc32=0;
  567.  
  568.                         rescrc32= objcrc32.GetCrc32( &msg_crc,CRC_LENGTH ); //objcrc32. 
  569.  
  570.                         //allmsg.crc=rescrc32; 
  571.                         *pcrc=rescrc32; //090405
  572.                         //write_struct(0);  090408
  573.                         #ifdef _LITTLE_ENDIAN
  574.  
  575.                                         message[12]= pcrc[0];
  576.                                         message[13]= pcrc[1]; 
  577.                                         message[14]= pcrc[2]; 
  578.                                         message[15]= pcrc[3];
  579.  
  580.                         /*                message[12]= (char)(rescrc32 & 0x000000FF); //GOOD TOO
  581.                                         message[13]= (char)((rescrc32>>8) & 0x0000FF);
  582.                                         message[14]= (char)((rescrc32>>16) & 0x00FF);
  583.                                         message[15]= (char)(rescrc32>>24);
  584.                         */
  585.                         #else
  586.  
  587.                                         message[12]= pcrc[3]; //GOOD
  588.                                         message[13]= pcrc[2]; 
  589.                                         message[14]= pcrc[1]; 
  590.                                         message[15]= pcrc[0];
  591.  
  592.                                         message[15]= (char)(rescrc32 & 0x000000FF); //GOOD TOO
  593.                                         message[14]= (char)((rescrc32>>8) & 0x0000FF);
  594.                                         message[13]= (char)((rescrc32>>16) & 0x00FF);
  595.                                         message[12]= (char)(rescrc32>>24);
  596.                         #endif
  597.  
  598.                         //write_struct(0); //ICIBUG
  599.  
  600.                         /*        
  601.                                 allmsg.card_number[14]=ptemp_badge_id[14];
  602.                                 allmsg.card_number[13]=ptemp_badge_id[13]; 
  603.                                 allmsg.card_number[12]=ptemp_badge_id[12];
  604.                                 allmsg.card_number[11]=ptemp_badge_id[11];
  605.                                 allmsg.card_number[10]=ptemp_badge_id[10]; 
  606.                                 allmsg.card_number[9]=ptemp_badge_id[9]; 
  607.                                 allmsg.card_number[8]=ptemp_badge_id[8];
  608.                                 allmsg.card_number[7]=ptemp_badge_id[7];
  609.                                 allmsg.card_number[6]=ptemp_badge_id[6]; 
  610.                                 allmsg.card_number[5]=ptemp_badge_id[5]; 
  611.                                 allmsg.card_number[4]=ptemp_badge_id[4];
  612.                                 allmsg.card_number[3]=ptemp_badge_id[3];
  613.                                 allmsg.card_number[2]=ptemp_badge_id[2]; 
  614.                                 allmsg.card_number[1]=ptemp_badge_id[1]; 
  615.                                 allmsg.card_number[0]=ptemp_badge_id[0];
  616.                         */
  617.  
  618.                         /*
  619.                         printf("containe card_number\n", allmsg.card_number);
  620.                             for(int i=0; i < 15; ++i)
  621.                             {
  622.                             printf("%2d [0x%2.2X], [0x%2.2X]\n", i,allmsg.card_number[i],ptemp_badge_id[i]);
  623.                             }
  624.                         */
  625.                         printf("Sender ID = %d\n", allmsg.sender_id);
  626.                             for(int i=0; i < 4; ++i)
  627.                             {
  628.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[i]);
  629.                             }
  630.                         printf("\nEncryption key ID = %d\n", allmsg.encrypt_key_id);
  631.                             for(int i=0; i < 4; ++i)
  632.                             {
  633.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[4+i]); 
  634.                             }
  635.                         printf("\nEncrypted size = %d\n", allmsg.encrypt_size);
  636.                             for(int i=0; i < 4; ++i)
  637.                             {
  638.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[8+i]);
  639.                             }
  640.  
  641.                         printf("\nCRC-32 = %u\n",rescrc32);
  642.                             for(int i=0; i < 4; ++i)
  643.                             {
  644.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[12+i]);
  645.                             }
  646.                         printf("\nData length = %d\n", allmsg.data_length);
  647.                             for(int i=0; i < 4; ++i)
  648.                             {
  649.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[16+i]);
  650.                             }
  651.  
  652.                         printf("\nSequence number = %d\n", allmsg.sequence_number);
  653.                             for(int i=0; i < 4; ++i)
  654.                             {
  655.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[20+i]);
  656.                             }
  657.  
  658.                         printf("\nPacket type = %d\n", allmsg.packet_type);
  659.                             for(int i=0; i < 4; ++i)
  660.                             {
  661.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[24+i]);
  662.                             }
  663.  
  664.                         printf("\ndata: READER NUMBER = %d\n", allmsg.read_number);
  665.                             for(int i=0; i < 4; ++i)
  666.                             {
  667.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[28+i]);
  668.                             }
  669.                         //printf("\ndata: CARD NUMBER = %s\n", allmsg.card_number);   printf("%s\n", _i64toa(987654321234567890LL, bin, 2)); 
  670.                         printf("\ndata: CARD NUMBER = %Ld\n", temp_badge_id ); //gbadge_id //094008 remplacer paer temp_badge_id pui 
  671.                             for(int i=0; i < 16; ++i)
  672.                             {
  673.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[32+i]);
  674.                             if (i==14)printf("\n");
  675.                             }
  676.                         printf("\ndata: PIN CODE = %d\n", allmsg.pin_code);
  677.                             for(int i=0; i < 4; ++i)
  678.                             {
  679.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[48+i]);
  680.                             }
  681.  
  682.  
  683.                         printf("\n\nCOMPLETE MESSAGE:\n");
  684.  
  685.                         for(int i=0; i < 52; ++i) //090407 68 -> 52 disable padding bytes
  686.                         {
  687.                             printf("%2d[0x%2.2X], ", i, (unsigned char)message[i]);
  688.                             if (i==14||i==29||i==44||i==59) printf("\n");
  689.                         }
  690.  
  691.                         char *remote_ip=remote_host;
  692.  
  693.                         if (!error_code) 
  694.                         {    error_code =  pCVgtNotifyDll->vgt_client_open (&pCUdpClt, remote_ip,remote_port);
  695.                             if (error_code) 
  696.                             {    printf("dans if(error_code) \n");
  697.                                 if (DEBUG) fprintf(stderr," ERROR: udp client open returned error_code %ld \n",error_code);
  698.                                 sprintf(response,"error_code= %d",ERROR_NOTIFY_CLIENT_OPEN);
  699.                             }
  700.                         }
  701.  
  702.  
  703.                         if (!error_code) 
  704.                         {
  705.                             error_code =  pCVgtNotifyDll->vgt_client_send_to(&pCUdpClt, message,68); //68 -> 66
  706.                             if (error_code) 
  707.                             {
  708.                                 if (DEBUG) fprintf(stderr," ERROR: udp client send to returned error_code %ld \n",error_code);
  709.                                 sprintf(response,"error_code= %d",ERROR_NOTIFY_CLIENT_SEND_TO);
  710.                             }
  711.                         }
  712.  
  713.                         printf("\nWait for response... \n");
  714.                         if (!error_code) 
  715.                         {
  716.                             error_code =  pCVgtNotifyDll->vgt_client_wait_response (&pCUdpClt, (char *)response, MAX_PATH, &response_length, timeout_ms); //090406
  717.                             if (error_code) 
  718.                             {
  719.                                 if (DEBUG) fprintf(stderr," ERROR: udp client wait response returned error_code %ld \n",error_code);
  720.                                 sprintf(response,"error_code= %d",ERROR_NOTIFY_CLIENT_WAIT_RESPONSE);
  721.                             }
  722.                         }
  723.  
  724.                         if (!error_code) 
  725.                         {
  726.                             error_code =  pCVgtNotifyDll->vgt_client_close (&pCUdpClt);
  727.                             if (error_code) 
  728.                             {
  729.                                 if (DEBUG) fprintf(stderr," ERROR: udp client close returned error_code %ld \n",error_code);
  730.                                 sprintf(response,"error_code= %d",ERROR_NOTIFY_CLIENT_CLOSE);
  731.                             }
  732.                         }
  733.  
  734.  
  735.                         for(int i=0; i < response_length; ++i)
  736.                         {
  737.                         printf("%2d[0x%2.2X], ",i, (unsigned char)response[i]);
  738.                         if (i==14||i==29||i==44||i==59) printf("\n");
  739.  
  740.                         }
  741.  
  742.  
  743.                         init_struct=true;
  744.                         return error_code;
  745.                         }
  746.  
  747.  
  748.                         DLL_API(long) vgt_dest_S3100()
  749.                         {
  750.                         error_code=0;
  751.  
  752.                         free(response);
  753.                         printf("\n\nExiting...\n");
  754.                         delete pCrc32;
  755.  
  756.                         printf("\n");
  757.  
  758.                         return error_code;
  759.                         }
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
And in the call file call_S3100.cpp (main)
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  
  4.                     int main(int argc, char* argv[])
  5.                     {    
  6.  
  7.                         unsigned int rescrc32=0;
  8.  
  9.                         char remote_ip[16];
  10.                         int remote_port=0; 
  11.                         unsigned int act_doors=1;
  12.  
  13.                         __int64 badge_id=0;
  14.                         int seq_num=1;
  15.  
  16.                         ....
  17.                         ....
  18.  
  19.  
  20.                     error_code = pCVgtS3100_interface->vgt_init_S3100( remote_ip, remote_port, act_doors, seq_num);//IMPL_1
  21.                     if (error_code) 
  22.                     {
  23.                         if (DEBUG) fprintf(stderr," ERROR: S3100 init returned error_code %ld \n",error_code);
  24.                         sprintf(response,"error_code= %d",ERROR_S3100_INTERFACE_INIT);
  25.                     }
  26.                     printf("\n");
  27.  
  28.  
  29.  
  30.                         .....
  31.                         .....
  32.  
  33.                     error_code =pCVgtS3100_interface->vgt_sendto_S3100(badge_id,remote_ip,remote_port);
  34.                     if (error_code) 
  35.                     {
  36.                         if (DEBUG) fprintf(stderr," ERROR: S3100 send to returned error_code %ld \n",error_code);
  37.                         sprintf(response,"error_code= %d",ERROR_S3100_INTERFACE_SEND_TO);
  38.                     }    
  39.  
  40.                         .....
  41.  
  42.  
  43.  
In resume the problem is to use good way to pass an __int64 to an unsigned char of [16] . Perhaps us mask :

Expand|Select|Wrap|Line Numbers
  1. allmsg.card_number[0]=(((unsigned char)&badgeid) & 0x00000000000000FF); 
  2. allmsg.card_number[1]= (unsigned char)(&badgeid & 0x000000000000FF); 
  3. allmsg.card_number[2]= (unsigned char)(&badgeid & 0x0000000000FF);
  4. allmsg.card_number[3]= (unsigned char)(&badgeid & 0x00000000FF); allmsg.card_number[4]= (unsigned char)(&badgeid & 0x000000FF); 
  5. allmsg.card_number[5]= (unsigned char)(&badgeid & 0x0000FF); allmsg.card_number[6]= (unsigned char)(&badgeid & 0x00FF); allmsg.card_number[7]= (unsigned char)(&badgeid & 0xFF); 
  6.  
  7.  
is this correct and how aboute the next [8] to [16] ?
how fix these problems?

Could you help me please.

Thank you

Kenzo
Apr 9 '09 #1
29 9955
Kenzogio
16 New Member
Ok,

So for resuming all I wrote before.

I have this struct :

struct frame_message {
//typedef struct {
unsigned int sender_id;
unsigned int encrypt_key_id;
unsigned int encrypt_size;
unsigned int crc;
unsigned int data_length;
unsigned int sequence_number ;
unsigned int packet_type;
unsigned int read_number;
unsigned char card_number[16];/////
unsigned int pin_code;
unsigned char padding_bytes[MAX_PADDING];
}allmsg;

And I pass to allmsg.card_num ber an _int64 but it is not good way
fonction pass(_int64 badgeid)
{

allmsg.card_num ber=(unsigned char*)&badgeid; //erreur incompatible signes assignement of (unsigned char* to unsigned char [16]

...


}
Could you fix me please ?

Thank you
Apr 10 '09 #2
Savage
1,764 Recognized Expert Top Contributor
__int64 is 8 bytes long,so I don't see why are you trying to fill a 16byte array with 8 byte number?Unless you want to do something like this:

Expand|Select|Wrap|Line Numbers
  1. __int64 number=9223372036854775807 //2^63-1--> it's just an example
  2. char Array[20]="";//but then you need 20 byte array as you can see
  3.  
and you would like your array to become:"9223372 036854775807"

Expand|Select|Wrap|Line Numbers
  1.     //Then you can use _i64toa
  2.     _i64toa(number,Array,10);
  3.  
Is this what you want?
Apr 10 '09 #3
Kenzogio
16 New Member
Thank you Savage,

Exactly, I want : the contain in _int64 must be the same (but in bytes) format in card_number[16] .

For example when I display containt of my variables:

//(printf of temp_badge_id )
data: CARD NUMBER = 123456789

//(printf for of allmsg.card_num ber[] )
0[0x00], 1[0x00], 2[0x00], 3[0x00], 4[0xB7], 5[0xFA], 6[0x09], 7[0xC8], 8[0x00], 9[0x00], 10[0x00], 11[0x00], 12[0x07], 13[0x5B], 14[0xCD],
15[0x15],
Like you see long long int: 123456789 in hex is 75BCD15 (bytes 12 -> 15 )
but what is contain of byes 4 -> 7 ?? strange

I think that problems come before from here:
allmsg.card_num ber[15]=ptemp_badge_id[15];
allmsg.card_num ber[14]=ptemp_badge_id[14];
...
..

allmsg.card_num ber[0]=ptemp_badge_id[0];
But I'm not sure ?
So maybe iproblem is to pass correctly __int64 to unsigned char [] of 16 bytes

Thank you
Apr 10 '09 #4
Savage
1,764 Recognized Expert Top Contributor
Have you tried a simple memcopy?

Expand|Select|Wrap|Line Numbers
  1. __int64 number=0x75BCD15;
  2. char Array[16]="";
  3. memcopy(Array,&number,8);
It should do what you want..
Apr 10 '09 #5
weaknessforcats
9,208 Recognized Expert Moderator Expert
SO the card_number is a char (8 bits) and you want to put an _int64 (64 bits) in the char? I assume the value in the _int64 will fit in the char. Next since char is an integer an _int64 is an integer, can you not just assign the _Int64 to the char?

There should be no need for a memcpy(). In fact, that could screw things up when your _int64 has a 2's complement value in it.
Apr 10 '09 #6
Kenzogio
16 New Member
Hi,
Thanks in fact the goal is that with some type of long long integer I must fit the entered value in exactly 16 bytes of char (or 128 bits) ... So I choice to use an _int64 but perhaps is there another type of long integer which is in 16 bytes just like may char array, and so with this one it will be more easy I think, could you advise me another solution ?

But for the moment, I use an _int64 and your solution with memcopy() I try this but compiler says some error message( memcopy() is not in the scope) so I must include an header file but which one ?

Thank you

Kenzo
Apr 11 '09 #7
Savage
1,764 Recognized Expert Top Contributor
@Kenzogio
That's because it's memcpy() and not memcopy(), I've made a typo :P

Weakness, could you please explain how is it that it will cause problems when there are two complements?
Apr 12 '09 #8
Kenzogio
16 New Member
Hi,

i think that I tried too with memcpy() but anyway I will try again.

So what you mean when saying "..when there are two complements" ?
If I well understand I explained the fact that if it's possible to use a more big int type than _int64 so exactly a 16 bytes types for example I don't know "long double int" and to get contain of it into my 16 bytes char 'allmsg.number_ card[x]`' and how implement this conversion type (e.g. with masks, modulo, .. )


Thank you
Apr 12 '09 #9
Kenzogio
16 New Member
Hi,

Sorry yes I try with memcpy() and it's ok cool.

But now my problem is to use a much bigger (size * 2) variable than the __int64 to fit correctly data into my 16 bytes array.

Thank you
Apr 14 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4770
by: Matt Whelan | last post by:
Supposedly, recent versions of SWIG can be made to work with MS VC++'s non-standard integer data types. According to a recent SWIG ChangeLog entry: %apply long long { __int64 }; should make Swig happy. But it doesn't. I get Syntax Errors on each line where __int64 appears. Am I missing something? I'm new to SWIG (but not to Python or C++).
11
2254
by: lokb | last post by:
Hi, I have a structure which and defined a smart pointer to the structure. /* Structure of Begin Document Index Record */ typedef struct BDI_Struct{ unsigned char rname; unsigned short int rlen; int code; short int reserved; char indexName;
4
4440
by: James Roberge | last post by:
I am having a little trouble getting my union/struct to work correctly. I am creating a struct that will contain information about the status of various Z80 cpu registers in an emulator i am trying to write. some of the registers such as "DE" can be accessed as 16 bit data or the high and low bytes can be accessed separately. SO, "DE" refers to the 16 bit data, where "D" and "E" refer to the high and low bytes respectively. Here is...
19
16787
by: Vincent | last post by:
Hi all, I want to convert a char (binary) to an unsigned long. How can I do this? Thanks, Vincent
8
3372
by: hurry | last post by:
hi, I am writing a c program in VC++ 6. I have 2 files with 3 functions. file-1 having two functions "a" and "c" file-2 having a single function "b" with function "a" as main() , "a" calls function "b" in file-2 which,
4
14962
by: cdrom205 | last post by:
static void MDString ( unsigned char *input) { MD5_CTX context; unsigned char digest; unsigned int len = sizeof(input);//strlen (const char*) md5.MD5Init (&context); md5.MD5Update (&context, input, len); // void MD5Update (MD5_CTX *context, unsigned char *input, unsigned
4
15340
by: techie | last post by:
I have defined a number of unsigned integer types as follows: typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedfe long long uint64; Is it necessary to explicitly cast from one type of unsigned integer type to another even though they do so implicitly?
3
14565
by: uche | last post by:
Please give me some feed back on this issue: Here is the complier error: hexdmp.cpp: In function `void output(unsigned char, int, bool&)': hexdmp.cpp:133: error: invalid types `unsigned char' for array subscript hexdmp.cpp:146: error: invalid types `unsigned char' for array subscript hexdmp.cpp:146: error: invalid types `unsigned char' for array
5
2439
by: Jeff Bean | last post by:
I need to compute a 64 bit file offset which will get passed to the _lseeki64 function. The inputs to the offset calculation are all unsigned shorts or unsigned longs. For example: unsigned short page_size; unsigned long page_index; unsigned long page_offset; __int64 file_offset; file_offset = (page_size * page_index) + page_offset;
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.