Results 1 to 2 of 2

Thread: Data Type

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    76

    Data Type

    How can I manipulate a char array as a long integer array, i.e. 4 bytes at a time rather than 1 byte per instruction?

    CRYPTOFACILITY_API int _stdcall cbcenc(char * srcfid, char * dstfid, unsigned char * key, unsigned char * mac)
    {
    register int i;
    for (i = 0; i < 8; i++) mac[i] = 0x00;
    }

    In the above case, how can I initialise mac by assignment of =0x00000000 without changing the type definition of formal arguments?

    Thanks.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    C:
    unsigned int *piMac = (unsigned int *)mac;
    C++:
    unsigned int *piMac = reinterpret_cast<unsigned int *>(mac);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width