Hi,
I'm reading a text file using a readstream and it fails with unidentied object error. If I cut the size down it works file, it looks like it has reached a limit and this is causing the "file" to become nil. Note: I've used this method (nextline) of reading text files on many an occassion without problems. Any ideas how to fix this? Thanks, Theo |
Theo,
> I'm reading a text file using a readstream and it fails with > unidentied object error. If I cut the size down it works file, it > looks like it has reached a limit and this is causing the "file" to > become nil. How big is the file that fails? -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
In reply to this post by Theo Pronk
Theo,
> I'm reading a text file using a readstream and it fails with > unidentied object error. If I cut the size down it works file, it > looks like it has reached a limit and this is causing the "file" to > become nil. How big is the file that fails? -- Ian |
In reply to this post by Ian Bartholomew-18
Hi Ian,
Had some problem with e-mail and lost the first "complete" message with all sorts of information and stuff... Anyway I meant to at least include the size which is just over 3 Mbytes. Regards, Theo =================== Ian Bartholomew wrote: > Theo, > > >>I'm reading a text file using a readstream and it fails with >>unidentied object error. If I cut the size down it works file, it >>looks like it has reached a limit and this is causing the "file" to >>become nil. > > > How big is the file that fails? > |
Theo,
> Anyway I meant to at least include the size which is just over 3 > Mbytes. You shouldn't have any trouble with that at all [1]. I just created a 30MB file and evaluated the following without any problems. fs := FileStream read: 'c:\x.txt'. [text := fs contents] ensure: [fs close]. text size "answers 30670849" fs := FileStream read: 'c:\x.txt'. [[fs atEnd] whileFalse: [fs next]] ensure: [fs close]. fs := FileStream read: 'c:\x.txt'. [[fs atEnd] whileFalse: [fs nextAvailable: 10000]] ensure: [fs close]. What is the actual walkback you are getting and how are you trying to create and access the stream?. [1] As far as I know there are no limits imposed by Dolphin but I tried with a 400MB file and ran into horrendous problems with disk swapping that necessitated the use of the power off button! -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
In reply to this post by Theo Pronk
Theo,
> Had some problem with e-mail and lost the first "complete" message with > all sorts of information and stuff... > > Anyway I meant to at least include the size which is just over 3 Mbytes. Unless you meant to say 3 Gigabytes, the size should not be a problem even on 9x. You mentioned #nextLine. Is the data cr/lf delimited? Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Theo Pronk
Hi Ian/Bill,
Found the problem with your help. It wasn't he file size at all, my code was based on an example in the Smalltalk Companion, and I closed the file before processing the buffer. This has been working for me for several months, so I didn't suspect the code. The reason it worked before was that all files input before were relatively small and would be fully read on the first read from the file! Basically moved the file close to after fully processing the imput. The lesson to be learned (agaim) is, it may be easy to copy code, but you must fully understand it before using it in a different way. Thank, Theo ==============snip===================== Bill wrote: Unless you meant to say 3 Gigabytes, the size should not be a problem even on 9x. You mentioned #nextLine. Is the data cr/lf delimited? Bill ==============snip===================== Ian wrote. You shouldn't have any trouble with that at all [1]. I just created a 30MB file and evaluated the following without any problems. fs := FileStream read: 'c:\x.txt'. [text := fs contents] ensure: [fs close]. text size "answers 30670849" fs := FileStream read: 'c:\x.txt'. [[fs atEnd] whileFalse: [fs next]] ensure: [fs close]. fs := FileStream read: 'c:\x.txt'. [[fs atEnd] whileFalse: [fs nextAvailable: 10000]] ensure: [fs close]. What is the actual walkback you are getting and how are you trying to create and access the stream?. [1] As far as I know there are no limits imposed by Dolphin but I tried with a 400MB file and ran into horrendous problems with disk swapping that necessitated the use of the power off button! Ian. ==============snip===================== theo wrote: > Hi, > I'm reading a text file using a readstream and it fails with unidentied > object error. If I cut the size down it works file, it looks like it has > reached a limit and this is causing the "file" to become nil. The file is comma delimited and 3.5 Mega Bytes. > > Note: I've used this method (nextline) of reading text files on many an > occassion without problems. > > Any ideas how to fix this? > > Thanks, > Theo > > |
Free forum by Nabble | Edit this page |