Method

FolderItem.OpenAsVirtualVolume


Warning

This item was deprecated in version 2019r3. There is no replacement.

Description

Attempts to open the FolderItem as a VirtualVolume. It returns Nil if the FolderItem is not a VirtualVolume.

Notes

It is opened as Read/Write unless it is locked at the operating system level.

Sample code

The following example reads a text file that was saved earlier. It is passed the name of the file.

Sub ReadTextFile(s As String)
  ' reads the text file in the VirtualVolume
  Var f, virtualFile As Folderitem
  Var v As VirtualVolume
  f = FolderItem.ShowOpenFileDialog("myVirtualVolume")
  If f <> Nil Then
    v = f.OpenAsVirtualVolume
    If v <> Nil Then
      virtualFile = v.Root.Child(s)
      If VirtualFile <> Nil Then
        Var stream As BinaryStream
        stream = BinaryStream.Open(virtualFile, False)
        Do
          TextArea2.AddText(stream.Read(255))
        Loop Until stream.EndOfFile
        stream.Close
      End If
    End If
  End If
End Sub

Compatibility

All project types on all supported operating systems.