Re: What's wrong with my line counter script?
- From: "Paul Randall" <paulr901@xxxxxxxxxxxx>
- Date: Thu, 13 Mar 2008 15:14:43 -0600
"Eric Bragas" <ericbragas@xxxxxxxxx> wrote in message
news:19b0be87-0ed9-4b4f-ac27-2e7bce071e18@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
Below is the contents of my linecounter.vbs file, which I hoped was
going to be useful in telling me how many lines a text file
includes,
but seems to max out at 65,000 (give or take) even though I know my
files are over 800,000 lines of text. Any suggestions? I'm
obviously
oversimplifying or else this wouldn't be a problem.
Thanks,
Eric
----linecounter.vbs--------------------------------------------
Dim objArgs
Set objArgs = WScript.Arguments
TgtFile = objArgs(0)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(TgtFile)
ra = f.ReadAll
msg = objArgs(0) & vbcrlf
msg = msg & " line count: " & f.Line
WScript.Echo msg
--(end)------------------------------------------------------------
You are creating the textstream object, f, without specifying a
format, so it defaults to ASCII, according to the documentation. If
the file happens to actually be formatted as Unicode, then you may
have problems reading it properly.
You could read the first two characters (as ASCII) -- I've never seen
a Unicode file read fail in the first two characters. If they are hex
FF FE or FE FF, then the file system thinks it is Unicode and you may
have problems, unless you specify the format as Unicode.
-Paul Randall
.
- References:
- What's wrong with my line counter script?
- From: Eric Bragas
- What's wrong with my line counter script?
- Prev by Date: Re: What's wrong with my line counter script?
- Next by Date: Error 80041017 Looping through Array on Win 2000
- Previous by thread: Re: What's wrong with my line counter script?
- Next by thread: Re: What's wrong with my line counter script?
- Index(es):
Relevant Pages
|