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


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

Re: Something rather odd: results change by adding blank lines to the code

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Something rather odd: results change by adding blank lines to the code
Date 2018-02-28 10:01 -0500
Organization A noiseless patient Spider
Message-ID <p76g9f$v83$1@dont-email.me> (permalink)
References <p7630h$1oem$1@gioia.aioe.org>

Show all headers | View raw


"R.Wieser" <address@not.available> wrote

| I'm writing some script to check if a certain file does infact contain
| unicode, or is just ASCII formatted that way.   The code is nothing 
special,
| just using a ReadAll to get the file contents, and than function which
| checks the first two chars (&hFF, &hFE) and a loop checking each second 
char
| (&h00).
|
    Use Read(x) instead of ReadAll. Microsoft,
in their wisdom, were trying to protect us from
binary files. ReadAll stops at the first null.

'---------------------------------
s = TS.Read(100)
A = GetArray(s)

' A is now a byte array that's accessible and you
' can walk it to check for nulls.

Function GetArray(sStr)
Dim iA, Len1, Len2, AStr()
  On Error Resume Next
  Len1 = Len(sStr)
  ReDim AStr(Len1 - 1)
    For iA = 1 to Len1
      AStr(iA - 1) = Asc(Mid(sStr, iA, 1))
    Next
  GetArray = AStr
End Function

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


Thread

Something rather odd: results change by adding blank lines to the code "R.Wieser" <address@not.available> - 2018-02-28 12:15 +0100
  Re: Something rather odd: results change by adding blank lines to the code Wally W. <ww84wa@aim.com> - 2018-02-28 08:05 -0500
    Re: Something rather odd: results change by adding blank lines to the code "R.Wieser" <address@not.available> - 2018-02-28 15:14 +0100
  Re: Something rather odd: results change by adding blank lines to the code JJ <jj4public@vfemail.net> - 2018-02-28 20:25 +0700
    Re: Something rather odd: results change by adding blank lines to the code Wally W. <ww84wa@aim.com> - 2018-02-28 08:38 -0500
    Re: Something rather odd: results change by adding blank lines to the code "R.Wieser" <address@not.available> - 2018-02-28 14:55 +0100
  Re: Something rather odd: results change by adding blank lines to the code "Mayayana" <mayayana@invalid.nospam> - 2018-02-28 10:01 -0500
    Re: Something rather odd: results change by adding blank lines to the code "R.Wieser" <address@not.available> - 2018-02-28 17:16 +0100

csiph-web