thanks for your answer that makes me progress...i'm trying this but that makes mozilla completely crash when invoking the "readLine()" function(under Win2000) :

try
{
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("c:\\myFile.txt");


var fileStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
fileStream.init(file,0x01,0444,null);

fileStream = fileStream.QueryInterface(Components.interfaces.nsILineInputStream);

var line;

while(fileStream.readLine(line))
{
alert(line);
}

fileStream.close();
}
catch(e)
{
alert(e);
}


notice that the variable "fileStream" is not null and seems to be a correct implementation of both interfaces : nsIFileInputStream (needed to initialise the stream) AND nsILineInputStream (needed to read line by line)

thanks for giving me other ideas,

regards,

Fabrice


Santiago Aguiar wrote:
On Wed, 2004-10-27 at 12:03, Fabrice Esti�venart wrote:

var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);

var line;
while(inputStream.readLine(line)){
alert(line);
}


I think the problem is that you need to query it for a line input
stream... the following code should work...

inputstream.QueryInterface(Components.interfaces.nsILineInputStream);
while (inputstream.readLine(line)) {
        alert (line.value);
}

saludos!! santiago.

netlabs
Palmar 2548
Montevideo, Uruguay
+(598 2) 707-7687
[EMAIL PROTECTED]

_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to