本文整理匯總了VB.NET中System.IO.SeekOrigin枚舉的典型用法代碼示例。如果您正苦於以下問題:VB.NET SeekOrigin枚舉的具體用法?VB.NET SeekOrigin怎麽用?VB.NET SeekOrigin使用的例子?那麽, 這裏精選的枚舉代碼示例或許可以為您提供幫助。
在下文中一共展示了SeekOrigin枚舉的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: FSSeek
' 導入命名空間
Imports System.IO
Public Class FSSeek
Public Shared Sub Main()
Dim offset As Long
Dim nextByte As Integer
' alphabet.txt contains "abcdefghijklmnopqrstuvwxyz"
Using fs As New FileStream("c:\temp\alphabet.txt", FileMode.Open, FileAccess.Read)
For offset = 1 To fs.Length
fs.Seek(-offset, SeekOrigin.End)
Console.Write(Convert.ToChar(fs.ReadByte()))
Next offset
Console.WriteLine()
fs.Seek(20, SeekOrigin.Begin)
nextByte = fs.ReadByte()
While (nextByte > 0)
Console.Write(Convert.ToChar(nextByte))
nextByte = fs.ReadByte()
End While
Console.WriteLine()
End Using
End Sub
End Class
輸出:
zyxwvutsrqponmlkjihgfedcba uvwxyz