Fred Flintstone
04-25-2003, 12:20 PM
Hello!
I was wondering if anyone knows how to check for the "end-of-file" using Javascript and Active X.
I want to perform a while loop using the condition "while not end-of-file". Unfortunately, EOF, eof, EOF(), eof()... do not work at all in Microsoft internet explorer 6.
Here is part of my code:
// This creates a new Active X Object in order to read in a file.
file = new ActiveXObject("Scripting.FileSystemObject");
// Sets the variable "f" to equal the new open file contents
f = file.OpenTextFile("c:\\wantlist.txt", 1);
/* This SHOULD keep looping until it reaches the end of the file but doesn't!! It actually keeps looping without correctly checking the condition until a javascript error pops up saying it's already reached the end of file when it tries to read in the line. */
while(!line.EOF())
{
line = f.ReadLine();
}
Anyone know the correct syntax for checking an End-of-file for Javascript using Microsoft Internet Explorer 6 and up??
I'd appreciate any help!
I was wondering if anyone knows how to check for the "end-of-file" using Javascript and Active X.
I want to perform a while loop using the condition "while not end-of-file". Unfortunately, EOF, eof, EOF(), eof()... do not work at all in Microsoft internet explorer 6.
Here is part of my code:
// This creates a new Active X Object in order to read in a file.
file = new ActiveXObject("Scripting.FileSystemObject");
// Sets the variable "f" to equal the new open file contents
f = file.OpenTextFile("c:\\wantlist.txt", 1);
/* This SHOULD keep looping until it reaches the end of the file but doesn't!! It actually keeps looping without correctly checking the condition until a javascript error pops up saying it's already reached the end of file when it tries to read in the line. */
while(!line.EOF())
{
line = f.ReadLine();
}
Anyone know the correct syntax for checking an End-of-file for Javascript using Microsoft Internet Explorer 6 and up??
I'd appreciate any help!