On 2006-12-12, at 19:38, Ed Harris wrote:


I am running into a problem that has been discussed occasionally over the
past 6 years, but I can't find a definite solution.  It concerns the
"createtextfile" method sometimes returning a NIL object.  This occurs
primarily on Mac OS X 10.3.



The code is essentially:

Dim fi as FolderItem

Dim tos as TextOutputStream
fi = GetFolderItem("Temp.html")
tos = fi.CreateTextFile
tos.write "This is a test"
tos.close
It seems to almost always work on OS X 10.4, by the way, and always works on
a Windows machine.


Additional information: the file "Temp.html" exists and I am expecting it to
be overridden.  Also, I have added "errNr = fi.LastErrorCode" after the
GetFolderItem line.  When the CreateTextFile method fails and returns NIL,
the value of errNr is 104.

Any ideas on what is going on and how to fix it?


Thanks,

Ed

I have no problems with the . CreateTextFile method. I use it in several applications. I am running 10.3.9 on a G4 PPC

However, I check if the file "Temp.html" exists. If it does, I delete it first, because you cannot create a new one with the same name. Maybe !0.4.x gives no error when creating a second file with the same name and automatically appends a version suffix. Like so:

Dim fi as FolderItem
Dim tos as TextOutputStream

fi = GetFolderItem("Temp.html")
if fi.exits Then fi.Delete
tos = fi.CreateTextFile

--
   Cheers,
   Peter

    TI PowerBook G4, 1GHz, 1GB RAM, OSX 10.3.9, RB2006r4 Pro
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to