StreamWriter 建構函式

定義

初始化 StreamWriter 類別的新執行個體。

多載

StreamWriter(Stream)

使用 UTF-8 編碼方式和預設緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體。

StreamWriter(String)

使用預設編碼方式和緩衝區大小,為指定的檔案初始化 StreamWriter 類別的新執行個體。

StreamWriter(Stream, Encoding)

使用指定的編碼方式和預設緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體。

StreamWriter(String, Boolean)

使用預設編碼方式和緩衝區大小,為指定的檔案初始化 StreamWriter 類別的新執行個體。 如果檔案存在,可以將它寫入或附加。 如果檔案不存在,這個建構函式會建立新的檔案。

StreamWriter(String, FileStreamOptions)

StreamWriter使用預設編碼方式,並使用指定的物件進行設定,初始化指定檔案的類別的新實例 FileStreamOptions

StreamWriter(Stream, Encoding, Int32)

使用指定的編碼方式和緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體。

StreamWriter(String, Boolean, Encoding)

使用指定的編碼方式和預設緩衝區大小,為指定的檔案初始化 StreamWriter 類別的新執行個體。 如果檔案存在,可以將它寫入或附加。 如果檔案不存在,這個建構函式會建立新的檔案。

StreamWriter(String, Encoding, FileStreamOptions)

StreamWriter使用指定的編碼方式,並設定指定的物件,初始化類別的新實例 FileStreamOptions

StreamWriter(Stream, Encoding, Int32, Boolean)

使用指定的編碼方式和緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體,並選擇性讓資料流保持開啟。

StreamWriter(String, Boolean, Encoding, Int32)

使用預設編碼方式和緩衝區大小,為指定路徑上的指定檔案初始化 StreamWriter 類別的新執行個體。 如果檔案存在,可以將它寫入或附加。 如果檔案不存在,這個建構函式會建立新的檔案。

StreamWriter(Stream)

使用 UTF-8 編碼方式和預設緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體。

public:
 StreamWriter(System::IO::Stream ^ stream);
public StreamWriter (System.IO.Stream stream);
new System.IO.StreamWriter : System.IO.Stream -> System.IO.StreamWriter
Public Sub New (stream As Stream)

參數

stream
Stream

要寫入的資料流。

例外狀況

stream 不可寫入。

streamnull

範例

下列程式碼範例示範此函式。

using System;
using System.IO;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";
            FileStream fs = null;
            try
            {
                fs = new FileStream(fileName, FileMode.CreateNew);
                using (StreamWriter writer = new StreamWriter(fs))
                {
                    writer.Write(textToAdd);
                }
            }
            finally
            {
                if (fs != null)
                    fs.Dispose();
            }
        }
    }
}
Imports System.IO

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"
        Dim fs As FileStream = Nothing
        Try
            fs = New FileStream(fileName, FileMode.CreateNew)
            Using writer As StreamWriter = New StreamWriter(fs)
                writer.Write(textToAdd)
            End Using
        Finally
            If Not fs Is Nothing Then
                fs.Dispose()
            End If
        End Try
    End Sub

End Module

備註

這個函式 StreamWriter 會建立具有 utf-8 編碼的, (BOM) 的 Byte-Order 標記,因此其 GetPreamble 方法會傳回空的位元組陣列。 這個函式的預設 UTF-8 編碼會在不正確位元組上擲回例外狀況。 這個行為與屬性中的編碼物件所提供的行為不同 Encoding.UTF8 。 若要指定是否在不正確位元組擲回例外狀況,請使用接受編碼物件做為參數的函式,例如 StreamWriterBaseStream使用參數初始化屬性 stream 。 資料流程的位置不會重設。

呼叫 StreamWriter 時,物件 Dispose() 會在所提供的物件上呼叫 Stream StreamWriter.Dispose

警告

當您使用特定的文化特性設定來編譯一組字元,並以不同的文化設定抓取這些相同的字元時,可能不會可解譯這些字元,而且可能會導致擲回例外狀況。

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。

另請參閱

適用於

StreamWriter(String)

使用預設編碼方式和緩衝區大小,為指定的檔案初始化 StreamWriter 類別的新執行個體。

public:
 StreamWriter(System::String ^ path);
public StreamWriter (string path);
new System.IO.StreamWriter : string -> System.IO.StreamWriter
Public Sub New (path As String)

參數

path
String

要寫入的完整檔案路徑。 path 可以是檔案名稱。

例外狀況

存取遭到拒絕。

path 為空字串 ("")。

-或- path 包含系統裝置的名稱 (com1、com2 等等)。

pathnull

指定的路徑無效 (例如,它位於未對應的磁碟機上)。

指定的路徑、檔案名稱,或兩者都超出系統定義的長度上限。

path 包含檔案名稱、目錄名稱或磁碟標籤語法的不正確或無效語法。

呼叫端沒有必要的權限。

範例

下列程式碼範例示範此函式。

using System;
using System.IO;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";

            using (StreamWriter writer = new StreamWriter(fileName))
            {
                writer.Write(textToAdd);
            }
        }
    }
}
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"

        Using writer As StreamWriter = New StreamWriter(fileName)
            writer.Write(textToAdd)
        End Using
    End Sub

End Module

備註

這個函式 StreamWriter 會建立具有 utf-8 編碼的, (BOM) 的 Byte-Order 標記,因此其 GetPreamble 方法會傳回空的位元組陣列。 這個函式的預設 UTF-8 編碼會在不正確位元組上擲回例外狀況。 這個行為與屬性中的編碼物件所提供的行為不同 Encoding.UTF8 。 若要指定 BOM 並判斷是否在不正確位元組擲回例外狀況,請使用接受編碼物件做為參數的函式,例如 StreamWriter(String, Boolean, Encoding)

path參數可以是檔案名,包括通用命名慣例上的檔案 (UNC) 共用。 如果檔案存在,則會覆寫該檔案;否則會建立新的檔案。

path參數不需要是儲存在磁片上的檔案,它可以是系統中支援使用資料流程存取的任何部分。

警告

當您使用特定的文化特性設定來編譯一組字元,並以不同的文化設定抓取這些相同的字元時,可能不會可解譯這些字元,而且可能會導致擲回例外狀況。

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。

另請參閱

適用於

StreamWriter(Stream, Encoding)

使用指定的編碼方式和預設緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體。

public:
 StreamWriter(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding);
public StreamWriter (System.IO.Stream stream, System.Text.Encoding encoding);
new System.IO.StreamWriter : System.IO.Stream * System.Text.Encoding -> System.IO.StreamWriter
Public Sub New (stream As Stream, encoding As Encoding)

參數

stream
Stream

要寫入的資料流。

encoding
Encoding

要使用的字元編碼。

例外狀況

streamencodingnull

stream 不可寫入。

範例

下列範例示範此函式。

using System;
using System.IO;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";
            FileStream fs = null;
            try
            {
               fs = new FileStream(fileName, FileMode.CreateNew);
               using (StreamWriter writer = new StreamWriter(fs, Encoding.Default))
                {
                    writer.Write(textToAdd);
                }
            }
            finally
            {
                if (fs != null)
                    fs.Dispose();
            }
        }
    }
}
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"
        Dim fs As FileStream = Nothing
        Try
            fs = New FileStream(fileName, FileMode.CreateNew)
            Using writer As StreamWriter = New StreamWriter(fs, Encoding.Default)
                writer.Write(textToAdd)
            End Using
        Finally
            If Not fs Is Nothing Then
                fs.Dispose()
            End If
        End Try
    End Sub

End Module

備註

這個函式會 Encoding 使用 encoding 參數和 BaseStream 使用資料流程參數的屬性來初始化屬性。 資料流程的位置不會重設。 如需詳細資訊,請參閱 Encoding

呼叫 StreamWriter 時,物件 Dispose() 會在所提供的物件上呼叫 Stream StreamWriter.Dispose

警告

當您使用特定的文化設定編譯一組字元,並使用不同的文化設定來抓取這些相同的字元時,可能不會可解譯字元,而且可能會導致擲回例外狀況。

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。

另請參閱

適用於

StreamWriter(String, Boolean)

使用預設編碼方式和緩衝區大小,為指定的檔案初始化 StreamWriter 類別的新執行個體。 如果檔案存在,可以將它寫入或附加。 如果檔案不存在,這個建構函式會建立新的檔案。

public:
 StreamWriter(System::String ^ path, bool append);
public StreamWriter (string path, bool append);
new System.IO.StreamWriter : string * bool -> System.IO.StreamWriter
Public Sub New (path As String, append As Boolean)

參數

path
String

要寫入的完整檔案路徑。

append
Boolean

true 表示要附加資料至檔案,false 表示要覆寫檔案。 如果指定的檔案不存在,則這個參數沒有任何作用,而且建構函式會建立新的檔案。

例外狀況

存取遭到拒絕。

path 是空的。

-或- path 包含系統裝置的名稱 (com1、com2 等等)。

pathnull

指定的路徑無效 (例如,它位於未對應的磁碟機上)。

path 包含檔案名稱、目錄名稱或磁碟標籤語法的不正確或無效語法。

指定的路徑、檔案名稱,或兩者都超出系統定義的長度上限。

呼叫端沒有必要的權限。

範例

下列程式碼範例示範此函式。

using System;
using System.IO;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";

            using (StreamWriter writer = new StreamWriter(fileName, true))
            {
                writer.Write(textToAdd);
            }
        }
    }
}
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"

        Using writer As StreamWriter = New StreamWriter(fileName, True)
            writer.Write(textToAdd)
        End Using
    End Sub

End Module

備註

這個函式 StreamWriter 會建立具有 utf-8 編碼的, (BOM) 的 Byte-Order 標記,因此其 GetPreamble 方法會傳回空的位元組陣列。 這個函式的預設 UTF-8 編碼會在不正確位元組上擲回例外狀況。 這個行為與屬性中的編碼物件所提供的行為不同 Encoding.UTF8 。 若要指定 BOM 並判斷是否在不正確位元組擲回例外狀況,請使用接受編碼物件做為參數的函式,例如 StreamWriter(String, Boolean, Encoding)

path參數可以是檔案名,包括通用命名慣例上的檔案 (UNC) 共用。

path參數不需要是儲存在磁片上的檔案,它可以是系統中支援使用資料流程存取的任何部分。

警告

當您使用特定的文化設定編譯一組字元,並使用不同的文化設定來抓取這些相同的字元時,可能不會可解譯字元,而且可能會導致擲回例外狀況。

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。

另請參閱

適用於

StreamWriter(String, FileStreamOptions)

StreamWriter使用預設編碼方式,並使用指定的物件進行設定,初始化指定檔案的類別的新實例 FileStreamOptions

public:
 StreamWriter(System::String ^ path, System::IO::FileStreamOptions ^ options);
public StreamWriter (string path, System.IO.FileStreamOptions options);
new System.IO.StreamWriter : string * System.IO.FileStreamOptions -> System.IO.StreamWriter
Public Sub New (path As String, options As FileStreamOptions)

參數

path
String

要寫入的完整檔案路徑。

options
FileStreamOptions

物件,指定基礎的設定選項 FileStream

例外狀況

optionsnull

stream 不可寫入。

另請參閱

適用於

StreamWriter(Stream, Encoding, Int32)

使用指定的編碼方式和緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體。

public:
 StreamWriter(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, int bufferSize);
public StreamWriter (System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize);
new System.IO.StreamWriter : System.IO.Stream * System.Text.Encoding * int -> System.IO.StreamWriter
Public Sub New (stream As Stream, encoding As Encoding, bufferSize As Integer)

參數

stream
Stream

要寫入的資料流。

encoding
Encoding

要使用的字元編碼。

bufferSize
Int32

緩衝區大小,以位元組為單位。

例外狀況

streamencodingnull

bufferSize 為負。

stream 不可寫入。

範例

下列範例示範此函式。

using System;
using System.IO;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";
            FileStream fs = null;
            try
            {
                fs = new FileStream(fileName, FileMode.CreateNew);
                using (StreamWriter writer = new StreamWriter(fs, Encoding.UTF8, 512))
                {
                    writer.Write(textToAdd);
                }
            }
            finally
            {
                if (fs != null)
                    fs.Dispose();
            }
        }
    }
}
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"
        Dim fs As FileStream = Nothing
        Try
            fs = New FileStream(fileName, FileMode.CreateNew)
            Using writer As StreamWriter = New StreamWriter(fs, Encoding.Default, 512)
                writer.Write(textToAdd)
            End Using
        Finally
            If Not fs Is Nothing Then
                fs.Dispose()
            End If
        End Try
    End Sub

End Module

備註

這個函式會 Encoding 使用參數來初始化屬性 encoding ,並 BaseStream 使用參數來 stream 初始化屬性。 資料流程的位置不會重設。 如需詳細資訊,請參閱 Encoding

呼叫 StreamWriter 時,物件 Dispose() 會在所提供的物件上呼叫 Stream StreamWriter.Dispose

警告

當您使用特定的文化設定編譯一組字元,並使用不同的文化設定來抓取這些相同的字元時,可能不會可解譯字元,而且可能會導致擲回例外狀況。

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。

另請參閱

適用於

StreamWriter(String, Boolean, Encoding)

使用指定的編碼方式和預設緩衝區大小,為指定的檔案初始化 StreamWriter 類別的新執行個體。 如果檔案存在,可以將它寫入或附加。 如果檔案不存在,這個建構函式會建立新的檔案。

public:
 StreamWriter(System::String ^ path, bool append, System::Text::Encoding ^ encoding);
public StreamWriter (string path, bool append, System.Text.Encoding encoding);
new System.IO.StreamWriter : string * bool * System.Text.Encoding -> System.IO.StreamWriter
Public Sub New (path As String, append As Boolean, encoding As Encoding)

參數

path
String

要寫入的完整檔案路徑。

append
Boolean

true 表示要附加資料至檔案,false 表示要覆寫檔案。 如果指定的檔案不存在,則這個參數沒有任何作用,而且建構函式會建立新的檔案。

encoding
Encoding

要使用的字元編碼。

例外狀況

存取遭到拒絕。

path 是空的。

-或- path 包含系統裝置的名稱 (com1、com2 等等)。

pathnull

指定的路徑無效 (例如,它位於未對應的磁碟機上)。

path 包含檔案名稱、目錄名稱或磁碟標籤語法的不正確或無效語法。

指定的路徑、檔案名稱,或兩者都超出系統定義的長度上限。

呼叫端沒有必要的權限。

範例

下列範例示範此函式。

using System;
using System.IO;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";

            using (StreamWriter writer = new StreamWriter(fileName, true, Encoding.UTF8))
            {
                writer.Write(textToAdd);
            }
        }
    }
}
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"

        Using writer As StreamWriter = New StreamWriter(fileName, True, Encoding.UTF8)
            writer.Write(textToAdd)
        End Using
    End Sub

End Module

備註

這個函式會 Encoding 使用 encoding 參數來初始化屬性。 如需詳細資訊,請參閱 Encoding

path 可以是檔案名,包括通用命名慣例上的檔案 (UNC) 共用。

path 不需要是儲存在磁片上的檔案;它可以是系統中任何支援透過資料流程存取的部分。

警告

當您使用特定的文化設定編譯一組字元,並使用不同的文化設定來抓取這些相同的字元時,可能不會可解譯字元,而且可能會導致擲回例外狀況。

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。

另請參閱

適用於

StreamWriter(String, Encoding, FileStreamOptions)

StreamWriter使用指定的編碼方式,並設定指定的物件,初始化類別的新實例 FileStreamOptions

public:
 StreamWriter(System::String ^ path, System::Text::Encoding ^ encoding, System::IO::FileStreamOptions ^ options);
public StreamWriter (string path, System.Text.Encoding encoding, System.IO.FileStreamOptions options);
new System.IO.StreamWriter : string * System.Text.Encoding * System.IO.FileStreamOptions -> System.IO.StreamWriter
Public Sub New (path As String, encoding As Encoding, options As FileStreamOptions)

參數

path
String

要寫入的完整檔案路徑。

encoding
Encoding

要使用的字元編碼。

options
FileStreamOptions

物件,指定基礎的設定選項 FileStream

例外狀況

optionsnull

stream 不可寫入。

另請參閱

適用於

StreamWriter(Stream, Encoding, Int32, Boolean)

使用指定的編碼方式和緩衝區大小,為指定的資料流初始化 StreamWriter 類別的新執行個體,並選擇性讓資料流保持開啟。

public:
 StreamWriter(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, int bufferSize, bool leaveOpen);
public StreamWriter (System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize, bool leaveOpen);
public StreamWriter (System.IO.Stream stream, System.Text.Encoding? encoding = default, int bufferSize = -1, bool leaveOpen = false);
new System.IO.StreamWriter : System.IO.Stream * System.Text.Encoding * int * bool -> System.IO.StreamWriter
Public Sub New (stream As Stream, encoding As Encoding, bufferSize As Integer, leaveOpen As Boolean)
Public Sub New (stream As Stream, Optional encoding As Encoding = Nothing, Optional bufferSize As Integer = -1, Optional leaveOpen As Boolean = false)

參數

stream
Stream

要寫入的資料流。

encoding
Encoding

要使用的字元編碼。

bufferSize
Int32

緩衝區大小,以位元組為單位。

leaveOpen
Boolean

true 表示在處置 StreamWriter 物件之後,將資料流保持開啟;否則為 false

例外狀況

streamencodingnull

bufferSize 為負。

stream 不可寫入。

範例

下列範例示範此函式。

using System;
using System.IO;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";
            FileStream fs = null;
            try
            {
                fs = new FileStream(fileName, FileMode.CreateNew);
                using (StreamWriter writer = new StreamWriter(fs, Encoding.UTF8, 512, false))
                {
                    writer.Write(textToAdd);
                }
            }
            finally
            {
                if (fs != null)
                    fs.Dispose();
            }
        }
    }
}
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"
        Dim fs As FileStream = Nothing
        Try
            fs = New FileStream(fileName, FileMode.CreateNew)
            Using writer As StreamWriter = New StreamWriter(fs, Encoding.Default, 512, False)
                writer.Write(textToAdd)
            End Using
        Finally
            If Not fs Is Nothing Then
                fs.Dispose()
            End If
        End Try
    End Sub

End Module

備註

除非您將 leaveOpen 參數設為 true ,否則 StreamWriter 物件會在呼叫 Dispose() 時呼叫所提供的 Stream 物件 StreamWriter.Dispose

這個函式會 Encoding 使用參數來初始化屬性 encoding ,並 BaseStream 使用參數來初始化屬性 stream 。 資料流程的位置不會重設。 如需詳細資訊,請參閱 Encoding 屬性。

警告

當您使用特定的文化設定編譯一組字元,並使用不同的文化設定來抓取這些相同的字元時,可能不會可解譯字元,而且可能會導致擲回例外狀況。

適用於

StreamWriter(String, Boolean, Encoding, Int32)

使用預設編碼方式和緩衝區大小,為指定路徑上的指定檔案初始化 StreamWriter 類別的新執行個體。 如果檔案存在,可以將它寫入或附加。 如果檔案不存在,這個建構函式會建立新的檔案。

public:
 StreamWriter(System::String ^ path, bool append, System::Text::Encoding ^ encoding, int bufferSize);
public StreamWriter (string path, bool append, System.Text.Encoding encoding, int bufferSize);
new System.IO.StreamWriter : string * bool * System.Text.Encoding * int -> System.IO.StreamWriter
Public Sub New (path As String, append As Boolean, encoding As Encoding, bufferSize As Integer)

參數

path
String

要寫入的完整檔案路徑。

append
Boolean

true 表示要附加資料至檔案,false 表示要覆寫檔案。 如果指定的檔案不存在,則這個參數沒有任何作用,而且建構函式會建立新的檔案。

encoding
Encoding

要使用的字元編碼。

bufferSize
Int32

緩衝區大小,以位元組為單位。

例外狀況

path 為空字串 ("")。

-或- path 包含系統裝置的名稱 (com1、com2 等等)。

pathencodingnull

bufferSize 為負。

path 包含檔案名稱、目錄名稱或磁碟標籤語法的不正確或無效語法。

呼叫端沒有必要的權限。

存取遭到拒絕。

指定的路徑無效 (例如,它位於未對應的磁碟機上)。

指定的路徑、檔案名稱,或兩者都超出系統定義的長度上限。

範例

下列範例示範此函式。

using System;
using System.IO;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "test.txt";
            string textToAdd = "Example text in file";

            using (StreamWriter writer = new StreamWriter(fileName, true, Encoding.UTF8, 512))
            {
                writer.Write(textToAdd);
            }
        }
    }
}
Imports System.IO
Imports System.Text

Module Module1

    Sub Main()
        Dim fileName As String = "test.txt"
        Dim textToAdd As String = "Example text in file"

        Using writer As StreamWriter = New StreamWriter(fileName, True, Encoding.UTF8, 512)
            writer.Write(textToAdd)
        End Using
    End Sub

End Module

備註

這個函式會 Encoding 使用 encoding 參數來初始化屬性。 如需詳細資訊,請參閱 Encoding

path 可以是檔案名,包括通用命名慣例上的檔案 (UNC) 共用。

path 不需要是儲存在磁片上的檔案;它可以是系統中任何支援透過資料流程存取的部分。

警告

當您使用特定的文化設定編譯一組字元,並使用不同的文化設定來抓取這些相同的字元時,可能不會可解譯字元,而且可能會導致擲回例外狀況。

如需一般 i/o 工作的清單,請參閱 一般 i/o工作。

另請參閱

適用於