Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 703 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
End of file in JavaScript

#1
I want to read a local file line by line in JavaScript. Ut I can check if it goes to the end of this file. For example:

file = new ActiveXObject("Scripting.FileSystemObject");

// Sets the variable "f" to equal the new open file contents

f = file.OpenTextFile("c:\\wantlist.txt", 1);
s = f.ReadLine()

While(s != EOF)
{
//. Do some thing
s = f.ReadLine()
}

What is EOF should be in JavaScript? Or do you have another way to deal with this problem? Thank you very much!

Reply

#2
Try:

f.AtEndOfStream


[To see links please register here]

Reply

#3
You're getting back a [FileStream](

[To see links please register here]

) object, so you want to use one of the properties that returns boolean to do what you're trying to do, such as [`AtEndOfStream`](

[To see links please register here]

)

However, now I'm going to get out my soapbox and ask why you're writing stuff for windows scripting with javascript, and why you don't choose to use something more modern like PowerShell, which will give you most of the flexibility of .NET objects, but almost all the scriptability of BASH or other scripting languages.

Then the method you're trying to accomplish here would be much easier to write/work with/get support on from other community members.

We're highly unlikely to recall the esoteric specifics of windows jscript programming (but obviously there are a few of us old farts still around)
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through