Question

I have a simple file like:

124
123
122
121
120

I try to read it in softimage using jscript.

I have this:

var ForReading = 1;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fileObj = fso.GetFile("F:\\temp\\csv_reader_01.txt");
var ts = fileObj.OpenAsTextStream(ForReading, 0 );

while(!ts.AtEndOfSream) {
    var textLine = ts.ReadLine();
    LogMessage(textLine);
}
ts.Close();


LogMessage("done");

With the following output:

// INFO : 124
// INFO : 123
// INFO : 122
// INFO : 121
// INFO : 120
// ERROR : Input past end of file - [line 29]

It goes wrong at this line:

var textLine = ts.ReadLine();

How can this be solved, i would excpect the ! AtEndOfSream to do this.

Was it helpful?

Solution

Is ts.AtEndOfSream a typo? It should be ts.AtEndOfStream (notice the missing 't' in 'Stream').

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top