Find the answer to your Linux question:
Results 1 to 3 of 3
Hi everyone, I am a dummy in C programming. I have a problem with copying the array of 64 elements of unsigned char to array of 8 element of uint64_t. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    14

    need help in Copying unsigned char to uint64_t


    Hi everyone,

    I am a dummy in C programming. I have a problem with copying the array of 64 elements of unsigned char to array of 8 element of uint64_t. For example:

    unsigned char p[64]
    uint64_t Data[8];

    memcpy (&Data, &p, 64);


    I am not sure if it is right. Please help me. Thanks a lot.

    Moreover, do both p and Data have 64 bytes?

  2. #2
    Just Joined!
    Join Date
    Sep 2010
    Posts
    14
    one more question is how to copy an uint64_t variable to uint64_t array of 8 elements. Thank you so much. I am looking forward to your reply

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,454
    Why do you want to do this? What is the purpose of the operation? In any case, yes you can do a memcpy() operation as you showed, but that may or may not be what you want to do. Hence, the reason for my first 2 questions.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •