2011-10-05 15 views

答えて

1

ここでのソリューションです。ただ、次のサブを使用し、必要に応じてパラメータを提供:

パラメータの説明:

FilepathToAppendToあなたはバイト配列

コンテンツを追加する必要があるファイルパスは、あなたのバイト配列は

です
Private Sub AppendByteToDisk(ByVal FilepathToAppendTo As String, ByRef Content() As Byte) 
    Dim s As New System.IO.FileStream(FilepathToAppendTo, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite) 
    s.Write(Content, 0, Content.Length) 
    s.Close() 
End Sub 
2

System.IO.FileStreamクラスメソッドを使用してください。追加ファイルモードでFileStreamを開く/作成する。

System.IO.FileStream(filename,System.IO.FileMode.Append) 
-1

前提条件。

  • UTF8エンコーディングを使用します。
using(var stream = File.AppendText(@"D:\test.txt")) 
{ 
    stream.WriteLine(Encoding.UTF8.GetString(b)); 
} 

VBのバージョン:

Using stream = File.AppendText("D:\test.txt") 
    stream.WriteLine(Encoding.UTF8.GetString(b)) 
End Using 
+0

質問に「vb.net」と明示的にタグ付けされている場合は、なぜ彼はC#コードの後ろだと思いますか? – Heinzi

+0

Doh! Didintはタグを見ます。 – Raghu

+0

何らかの理由で、書式設定がコードで機能しませんでした。私の簡潔さを許しなさい。 – Raghu

0
Dim bufData As Byte() 

' write the entire buffer in one line of code 
My.Computer.FileSystem.WriteAllBytes("BinaryFile.DAT", bufData, append := True) 
関連する問題