On Jun 8, 2006, at 12:39 AM, RBNUBE wrote:

Would you remind me what exactly are you trying to accomplish?

Storing a reference to a folder in a text file without using an absolute
path.

Ah. For this you should use FolderItem.GetSaveInfo. To store the data in a text file, you should encode the data using Base64, which returns "text".

Here is some sample code.

Sub Store(f as FolderItem, file as FolderItem)
  If f is nil then
    Return
  End if
  If file is nil then
    Return
  End if

  dim data as String = f.GetSaveInfo(nil, 0)
  dim t as TextOutputStream = file.OpenAsTextFile
  If t is nil then
    //check file.LastErrorCode
    Return
  End if
  t.WriteLine EncodeBase64(data, 0)
End Sub

Sub Retrieve(file as FolderItem) as FolderItem
  If file is nil then
    Return
  End if

  dim t as TextInputStream = file.OpenAsTextFile
  If t is nil then
    //check file.LastErrorCode
    Return nil
  End if

  dim data as String = DecodeBase64(t.ReadLine)
  Return GetFolderItem(data) //might be nil...
End Function

Charles Yeomans
_______________________________________________
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