Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #12427
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: Access the 3rd and rest elements of a Byte() (byte array)? |
| Date | 2022-03-08 16:57 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <t08jhr$cgc$1@dont-email.me> (permalink) |
| References | <7ikpiwc1wlb3.1jl0fbkule7nk$.dlg@40tude.net> <t07aqg$1ipv$2@gioia.aioe.org> <t07kg2$2b4$1@dont-email.me> <t08dhn$30u$1@gioia.aioe.org> |
"R.Wieser" <address@not.available> wrote
| * JJ mentioned that both "asc()" and "ascw()" work. I just found that
| "wscript.echo" also works - though it will try to interpret each two bytes
| as a single wide-character symbol. In my case got 13 question-marks.
| Alternating the written chars with a bunch of "chr(0)"-s causes the
"abc"...
| string to be displayed.
|
That seems odd. He specced it as ANSI English before declaring
it binary. So each byte should be a character. This works fine for me:
Set ds = createobject("adodb.stream")
ds.open
ds.charset = "windows-1252"
ds.writetext "abcdef"
ds.position = 0
ds.type = 1
For i = 0 to ds.size - 1
ds.position = i
x = ds.read(1)
MsgBox x
Next
ds.close
Set ds = Nothing
Oddly, if I don't set position to 0 first it says the operation
is not allowed. But as written I get a msgbox for a,b,c,d,e,f.
The trouble is that x is datatype byte() and VBS chokes on it.
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
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