User Profile

Collapse

Profile Sidebar

Collapse
Kenzogio
Kenzogio
Last Activity: Nov 24 '09, 09:56 PM
Joined: Apr 9 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Hi,

    So I wrote code like this




    but I have not what I expected for example I put parameter to my program argument to main here: 123456789123456 789
    and ithe display is not this. why ?
    Maybe the problem is on my way to use char * ?
    Could you you help me please ?

    Thank you

    Kenzo...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Hi,

    I have do that routine:
    Is that good the way ?


    ascii2binary (char* sourceAscii, char* destBin)
    {

    int64 lowPart = 0;
    int highPart = 0;

    for(int i=0; i<20; ++i)
    {
    lowPart += (sourceAscii[i]-48)*exp(10,i); //example= 10 exp 0 //corresponding to number 2 of 654342.
    ...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Hi,

    Not yet time to see quite for programming this routine :(
    any help will appreciate :)

    Thank you
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Ok,

    I will try to do :)

    Thank you
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Unfortunatly I'm using Kdevelop C++ in Linux
    So I don't know how make this routine.
    Could you give me an example code please ?

    Thank you
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Yes I understand but when you writed atol you mean atoll I suppose for an _int64 ?
    At time is it better to use long long int for atoll() or _int64 is too good as well for atoll()?


    For the routine could you help me more ?

    Thank you
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Sorry a little error occurs for this ;



    is not 128 but 120.

    Thank you...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Ok,

    So if we consider we are in big endian.

    using bit operators I will have:


    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)...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Hi,

    For more details, it's about a data packet to send. this packet containt severals "FIELD NAME" with her "FIELD SIZE" and "REMARKS"

    e.g:
    Code:
    [U]"FIELD NAME"             |        "FIELD SIZE"        |    REMARKS  [/U]
    Sender ID                |    4 bytes                 | identifies the source system to the destination system. 
    ...
    ...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    the problem is the size. I have a 16 byte array. and I must find a variable with 16 bytes too. Because the __int64 is only a 8 byte int and what must a store in the rest of my 8 bytes array?? I must use an integer which is more big than a simple _int64 for use efficiently the size.

    Thank you
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    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
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    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...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    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()...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    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:



    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:


    But I'm...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    replied to how pass an __int64 to unsigned char [16]
    in C
    Ok,

    So for resuming all I wrote before.

    I have this struct :



    And I pass to allmsg.card_num ber an _int64 but it is not good way


    Could you fix me please ?

    Thank you...
    See more | Go to post

    Leave a comment:


  • Kenzogio
    started a topic how pass an __int64 to unsigned char [16]
    in C

    how pass an __int64 to unsigned char [16]

    Hi,

    I have a struct "allmsg" and him member :
    Code:
     unsigned char card_number[MAX_CARD_NUMBER]; //16
    allmsg.card_num ber


    And I must store contain of an __int64 into this member

    Code:
    	__int64 temp_badge_id;
    	unsigned char *ptemp_badge_id; //

    So I pass value to this last :

    Code:
    DLL_API(long)
    ...
    See more | Go to post
No activity results to display
Show More
Working...