Re: Copying string to byte array
From: Jim Mack (jmack_at_mdxi.nospam.com)
Date: 01/13/05
- Next message: Paul fpvt2: "Re: The best way to yield processor to other users for long-runnin"
- Previous message: Mike D Sutton: "Re: The best way to yield processor to other users for long-runnin"
- In reply to: Sam Hobbs: "Re: Copying string to byte array"
- Next in thread: Sam Hobbs: "Re: Copying string to byte array"
- Reply: Sam Hobbs: "Re: Copying string to byte array"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 12 Jan 2005 20:16:47 -0500
Sam Hobbs wrote:
> "Jim Mack" <jmack@mdxi.nospam.com> wrote in message
> news:eXxw1CP%23EHA.1264@TK2MSFTNGP12.phx.gbl...
>>
>> The byte data does not exist "as-is" in the string to begin with,
>> since VB strings are Unicode. Any byte data will have been converted
>> to Unicode using the code page in effect at the time. If this is
>> the same code page used at the time it is converted back, then the
>> operation is transparent.
>>
>> If a different code page is in effect, then the (VB6) user can
>> specify the encoding code page as an extra argument to StrConv,
>> again making the operation transparent. If it is different and
>> unknown, then the conversion cannot be guaranteed transparent.
>
>
> The MSDN refers to binary data in a string, and I assumed that it is
> refering to essentially the same thing as what I mean. If so, then it
> seems to be misunderstood by everyone else. So perhaps I am using the
> term differently than the MSDN does, but regardlous, code pages are
> not relevant. When I say binary, I mean data that has no relevance
> whatsoever to characters. Binary data is not even fictional
> characters, so they have no correspondence whatsoever with code pages
> or anything related to code pages.
>
> I clarified what I meant by binary data in another post.
VB strings cannot contain arbitrary binary data. This is the reason
(stated by MS) that byte arrays were introduced into the language.
Don't even bother trying, it's a well-travelled road that leads to
misery. :-)
Bottom line: for arbitrary binary data, use byte arrays and never let it
touch a VB string -- not for file I/O, not for API parameters -- never.
--
Jim
- Next message: Paul fpvt2: "Re: The best way to yield processor to other users for long-runnin"
- Previous message: Mike D Sutton: "Re: The best way to yield processor to other users for long-runnin"
- In reply to: Sam Hobbs: "Re: Copying string to byte array"
- Next in thread: Sam Hobbs: "Re: Copying string to byte array"
- Reply: Sam Hobbs: "Re: Copying string to byte array"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|