Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Mayayana" Newsgroups: microsoft.public.scripting.vbscript Subject: Re: ADODB.Stream binary array to binary string failed unless x-user-defined is used Date: Wed, 18 Sep 2019 10:12:39 -0400 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: <1bn95rj9c5uuo$.1kp6nmuvwnw9e.dlg@40tude.net> Injection-Date: Wed, 18 Sep 2019 14:13:38 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="cbff86b1ffd7ceb347d4620219877449"; logging-data="7297"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UF+dPpEABdLpnHa/BpaRo+drMdbrku5Q=" Cancel-Lock: sha1:TV7K9IHKjGu6/O9+Z/JO1AaX3ME= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-Priority: 3 X-MSMail-Priority: Normal Xref: csiph.com microsoft.public.scripting.vbscript:12213 "JJ" wrote | WinXP(SP3) is v5.7.0.16599 Yes. | set fs = createobject("scripting.filesystemobject") | set f = fs.opentextfile("test.bin") | s = f.readall | f.close | wscript.echo len(left(s, 100)) 'shows 100 | z = left(s, 100) | wscript.echo len(z) 'shows 100 Not len. Just Left(s, 100). It should show the first 100 characters. MsgBox Left(s, 100). With your file I get a blank. With a GIF file I get only the first few characters, up to the first null. When I tried writing your file back to disk it did work, as you said, but doing the same with a GIF showed "invalid procedure call or argument". I don't know why the discrepancy. It's unpredictable because the FSO designers were assuming dumb IT people who only needed to deal with text. So you can handle nulls but in some cases they'll mess things up if you don't do it just so. That seems to also be the problem with the CharSet problem. FSO is altering characters "to be helpful". so when I used the Greek charset code to write a GIF back to disk, it was mostly OK, but there were minore glitches. For instance chr(34), a quote, got changed to something else that looked like 2 commas.