home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,429 of 10,840   
   Dean Earley to J French   
   Re: a problem with copymem API   
   19 Feb 07 09:13:50   
   
   From: dean.earley@icode.co.uk   
      
   J French wrote:   
   > On Fri, 16 Feb 2007 23:09:35 +1100, "Antony Clements"   
   >  wrote:   
   >   
   >> correction of mistake. i am only grabbing 4 bytes of both strings instead of   
   >> the original 8 and am trying to generate a number between 0 and 255255255255   
   >>from each 4 byte block of string   
   >   
   > You could just use CopyMemory to slap the 4 character string into a 4   
   > byte long   
   >   
   > This is not reliable in Far Eastern locales which use Multi Byte   
   > Character Sets, but with those areas the bets are off for strings.   
   >   
   > I gather you are doing some sort of encryption.   
      
   No, you CAN'T just CopyMemory from a 4 char string to a 4 byte long (and   
   get the results you expect.   
   As per my previous email, strings in vb are UTF-16 Unicode, meaning that   
   for normal ASCII text, EVERY character is followed by a single null byte.   
      
   To get the ASCII value of each character in each member of a byte array   
   (which you just proposed), you WILL need to use StrConv (unless you feel   
   like manually copying each character)   
      
   --   
   Dean Earley (dean.earley@icode.co.uk)   
   i-Catcher Development Team   
      
   iCode Systems   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca