-
File.readln() not returning string occasionally
From
Nightfox@VERT/DIGDIST to
All on Sun Aug 16 20:42:53 2009
Hi all -ããThe Synchronet JavaScript docs say that File's readln() function returns aãstring. I've run into a situation where it seems to return something differentãoccasionally. I was using readln() to read lines from a file, and there wereãsome blank lines at the end. When it gets to the last line, the thing returnedãby readln() seems to be of type "object" rather than "string" (I know thisãbecause I was using typeof() to test what was returned). Is it supposed to doãthat, or might it be a bug?ããNightfoxããããã---ã þ Synchronet þ Digital Distortion BBS: digdist.bbsindex.comã
-
From
Digital Man@VERT to
Nightfox on Mon Aug 17 00:44:26 2009
Re: File.readln() not returning string occasionallyã By: Nightfox to All on Sun Aug 16 2009 08:42 pmãã > Hi all -ã >ã > The Synchronet JavaScript docs say that File's readln() function returns aã > string. I've run into a situation where it seems to return somethingã > different occasionally. I was using readln() to read lines from a file,ã > and there were some blank lines at the end. When it gets to the last line,ã > the thing returned by readln() seems to be of type "object" rather thanã > "string" (I know this because I was using typeof() to test what wasã > returned). Is it supposed to do that, or might it be a bug?ããFile.readln() returns undefined when end of file is reached.ãã digital manããSnapple "Real Fact" #8:ãA bee has 5 eyes.ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
Deuce@VERT/SYNCNIX to
Digital Man on Mon Aug 17 09:59:25 2009
Re: File.readln() not returning string occasionallyã By: Digital Man to Nightfox on Mon Aug 17 2009 12:44 amãã > File.readln() returns undefined when end of file is reached.ããIf it's a typeOf object, it's most likely returning null. IIRC,ãtypeOf(undefined) isn't "object".ãã--- ãSynchronet - Jump on the Web 0.2 bandwagon!ãã---ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã
-
From
Nightfox@VERT/DIGDIST to
Digital Man on Mon Aug 17 11:47:01 2009
Re: File.readln() not returning string occasionallyã By: Digital Man to Nightfox on Mon Aug 17 2009 00:44:26ãã > > File.readln() returns undefined when end of file is reached.ããWhat's weird is that what I was seeing doesn't seem to be consistent. Thereãwere times when I could read an entire text file without problems, and thenãwhen reading one particular text file, the script exited with the error that myãfile line variable had no properties. With File.readln() returning undefinedãwhen the end of file is reached, wouldn't a script exit with that error everyãtime if it doesn't check the type of what readln() returned?ããI also had my file reading code in a loop that checked File's eof propertyã(i.e., while (!inFile.eof)).ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS: digdist.bbsindex.comã
-
From
Digital Man@VERT to
Nightfox on Mon Aug 17 13:54:57 2009
Re: File.readln() not returning string occasionallyã By: Nightfox to Digital Man on Mon Aug 17 2009 11:47 amãã > Re: File.readln() not returning string occasionallyã > By: Digital Man to Nightfox on Mon Aug 17 2009 00:44:26ã >ã > > > File.readln() returns undefined when end of file is reached.ã >ã > What's weird is that what I was seeing doesn't seem to be consistent.ã > There were times when I could read an entire text file without problems,ã > and then when reading one particular text file, the script exited with theã > error that my file line variable had no properties. With File.readln()ã > returning undefined when the end of file is reached, wouldn't a script exitã > with that error every time if it doesn't check the type of what readln()ã > returned?ã >ã > I also had my file reading code in a loop that checked File's eof propertyã > (i.e., while (!inFile.eof)).ããThat might depend on the file being read.ãã digital manããSnapple "Real Fact" #172:ãThe eye makes movements 50 times every second. ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã