Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12424

Re: Access the 3rd and rest elements of a Byte() (byte array)?

Path csiph.com!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From "R.Wieser" <address@not.available>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Access the 3rd and rest elements of a Byte() (byte array)?
Date Tue, 8 Mar 2022 11:22:57 +0100
Organization Aioe.org NNTP Server
Lines 30
Message-ID <t07aqg$1ipv$2@gioia.aioe.org> (permalink)
References <7ikpiwc1wlb3.1jl0fbkule7nk$.dlg@40tude.net>
Injection-Info gioia.aioe.org; logging-data="52031"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-RFC2646 Format=Flowed; Original
X-Newsreader Microsoft Outlook Express 6.00.2900.5512
X-Notice Filtered by postfilter v. 0.9.2
X-Priority 3
X-MSMail-Priority Normal
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.5512
Xref csiph.com microsoft.public.scripting.vbscript:12424

Show key headers only | View raw


JJ,

> msgbox asc(a) 'first element as byte

Whut ?   Where did you create/load the data into that "a" variable ?   Whats 
actually in it ?

Also, why do you think that "asc()" has antyhing to do with an array ?

> v = ascw(a) 'first & second element as int (16-bit integer)

No.

It just tries to convert the *wide-string character* in the variable "a" 
into a value.   If that "a" variable would contain a string (and not a 
single character) than it just takes the first character (*not* byte).

In your case that is moot though, as you have set your stream to binary.  As 
far as I can tell that means that *no multi-byte-character conversion* is 
done, and each read byte is placed in its own array element - even if it 
could be part of a multi-byte character.

I'm probably misunderstanding your problem, but here goes :

To access each character (byte?) in a string you need to use a mid(arr,i,1)

Regards,
Rudy Wieser

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Access the 3rd and rest elements of a Byte() (byte array)? JJ <jj4public@gmail.com> - 2022-03-08 06:24 +0700
  Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-08 11:22 +0100
    Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-08 08:07 -0500
      Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-08 21:15 +0100
        Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-08 16:57 -0500
        Re: Access the 3rd and rest elements of a Byte() (byte array)? JJ <jj4public@gmail.com> - 2022-03-09 10:58 +0700
          Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-09 10:39 +0100
      Re: Access the 3rd and rest elements of a Byte() (byte array)? Ulrich Möller <knobbi38@arcor.de> - 2022-03-11 11:23 +0100
        Re: Access the 3rd and rest elements of a Byte() (byte array)? "R.Wieser" <address@not.available> - 2022-03-11 13:14 +0100
        Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-11 09:12 -0500
          Re: Access the 3rd and rest elements of a Byte() (byte array)? Ulrich Möller <knobbi38@arcor.de> - 2022-03-11 18:41 +0100
            Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-11 15:58 -0500
        Re: Access the 3rd and rest elements of a Byte() (byte array)? JJ <jj4public@gmail.com> - 2022-03-12 06:24 +0700
          Re: Access the 3rd and rest elements of a Byte() (byte array)? "Mayayana" <mayayana@invalid.nospam> - 2022-03-11 19:30 -0500

csiph-web