Subject: B19.1: memcpy bug (NT)
From: [email-masked] (Vincent S. Perun)

21 Aug 1998 22:14:16 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: [email-masked]

Hello.  I've discovered a bug with memcpy under beta 19.1 and NT 4.0.  It
seems the contents of a char array don't copy into an int in the right order:
The bytes are reversed!  This test expects the output to be "ABCD" but it
puts out "CDAB".  A char to char memcpy works just fine!

Vincent Perun

Test program:

main()
{
   unsigned char s1[2] = {0xAB, 0xCD};
   unsigned short n;
   unsigned char s2[2];

   memcpy (&n, &s1, 2);
   printf ("n: %4.4X\n", n);
   memcpy (&s2, &s1, 2);
   printf ("s2: %2.2X%2.2X\n", s2[0], s2[1]);
}
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".