Opening a file on Win2000 - Squeak 2.4g/2.5a

Andreas Raab andreas.raab at gmx.de
Tue Jan 14 12:22:02 UTC 2003


Thierry,

Open the file in read-only mode or close it appropriately and all will
be well. The way you open it makes it read-write and by default files
you request write access to, cannot be opened again in write mode.
Therefore, if you change the first line to say:
	FileStream readOnlyFileNamed: '...'
everything should be all right.

Cheers,
  - Andreas

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Thierry Reignier
> Sent: Tuesday, January 14, 2003 9:51 AM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: [Q]: Opening a file on Win2000 - Squeak 2.4g/2.5a
> 
> 
> Hi,
> 
> I need to open a file and I do it with:
>    fileStream _ FileStream fileNamed: 'C:\Squeak\OUTWREC-4-0.rtf'.
>    ReadStream on: fileStream contentsOfEntireFile
>    ...
> 
> It works fine but atfer some time I get a debugger complaining:
>    MessageNotUnderstood: contentsOfEntireFile
>    VM: Win32 - Squeak3.3alpha of 24 January 2002 [latest 
> update: #4967]
>    Image: Squeak3.5alpha [latest update: #5168]
> 
> 1. Could it be that GC causes trouble? since FileStream is nil.
> StandardFileStream>>open: fileName forWrite: writeMode
>    "Open the file with the given name. If writeMode is true, allow
>    writing, otherwise open the file in read-only mode."
>    "Changed to do a GC and retry before failing ar 3/21/98 17:25"
>    fileID _ StandardFileStream retryWithGC:[self primOpen: fileName 
> writable: writeMode]
> 		until:[:id| id notNil]
> 		forFileNamed: fileName.
> 	fileID ifNil: [^ nil].  "allows sender to detect failure"
>    ...
> 
> 2. Or could it be that I am missing the FilePlugin mentioned in
> StandardFileStream>>primOpen: fileName writable: writableFlag
> 	"Open a file of the given name, and return the file ID obtained.
> 	If writableFlag is true, then
> 		if there is none with this name, then create one
> 		else prepare to overwrite the existing from the 
> beginning
> 	otherwise
> 		if the file exists, open it read-only
> 		else return nil"
> 
> 	<primitive: 'primitiveFileOpen' module: 'FilePlugin'>
> 	^ nil
> 
> 
> (same happens in 3.4g)
> 
> Thanks
> 
> Thierry
> 
> 
> 
> 
> 
> _________________________________________________________________
> The new MSN 8 is here: Try it free* for 2 months 
> http://join.msn.com/?page=dept/dialup
> 
> 




More information about the Squeak-dev mailing list