写入文件 (Visual Basic)Writing to Files in Visual Basic

本部分介绍了如何执行涉及写入文件的任务。This section explains how to perform tasks that involve writing to files.

本节内容In This Section

如何:向文件写入文本How to: Write Text to Files
演示如何写入文本文件。Demonstrates how to write to text files.

如何:向文本文件追加内容How to: Append to Text Files
演示如何将文本追加到文本文件。Demonstrates how to append text to a text file.

如何:写入二进制文件How to: Write to Binary Files
演示如何写入二进制文件。Demonstrates how to write to a binary file.

如何:将文本写入“我的文档”目录中的文件How to: Write Text to Files in the My Documents Directory
演示如何创建并写入“我的文档” 目录中的新文本文件。Demonstrates how to create and write to a new text file in the My Documents directory.

如何:使用 StreamWriter 向文件中写入文本How to: Write Text to Files with a StreamWriter
演示如何使用 System.IO.StreamWriter 对象写入文件。Demonstrates how to write to a file with a System.IO.StreamWriter object.

引用Reference

FileSystem
介绍 My.Computer.FileSystem 对象及其方法和属性。Describes the My.Computer.FileSystem object and its methods and properties.

OpenTextFileWriter
介绍 OpenTextFileWriter 方法。Describes the OpenTextFileWriter method.

WriteAllBytes
介绍 WriteAllBytes 方法。Describes the WriteAllBytes method.

WriteAllText
介绍 WriteAllText 方法。Describes the WriteAllText method.

从文件读取Reading from Files
介绍如何执行涉及从文件读取的任务。Explains how to perform tasks that involve reading from files.

创建、删除和移动文件和目录Creating, Deleting, and Moving Files and Directories
介绍如何执行涉及创建、删除、移动和重命名文件和目录的任务。Explains how to perform tasks that involve creating, deleting, moving, and renaming files and directories.

将数据存储到剪贴板以及从剪贴板读取数据Storing Data to and Reading from the Clipboard
解释如何执行与 My.Computer.Clipboard 相关联的任务,例如从剪贴板读取数据或向剪贴板写入数据。Explains how to perform tasks that are associated with My.Computer.Clipboard, such as reading data from or writing data to the Clipboard.

文件编码File Encodings
提供文件编码概述。Provides an overview of file encodings.