Share via


PathIO.WriteTextAsync 메서드

정의

오버로드

WriteTextAsync(String, String)

지정된 경로 또는 URI(Uniform Resource Identifier)의 파일에 텍스트를 씁니다.

WriteTextAsync(String, String, UnicodeEncoding)

지정된 문자 인코딩을 사용하여 지정된 경로 또는 URI(Uniform Resource Identifier)의 파일에 텍스트를 씁니다.

WriteTextAsync(String, String)

지정된 경로 또는 URI(Uniform Resource Identifier)의 파일에 텍스트를 씁니다.

public:
 static IAsyncAction ^ WriteTextAsync(Platform::String ^ absolutePath, Platform::String ^ contents);
/// [Windows.Foundation.Metadata.Overload("WriteTextAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncAction WriteTextAsync(winrt::hstring const& absolutePath, winrt::hstring const& contents);
[Windows.Foundation.Metadata.Overload("WriteTextAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncAction WriteTextAsync(string absolutePath, string contents);
function writeTextAsync(absolutePath, contents)
Public Shared Function WriteTextAsync (absolutePath As String, contents As String) As IAsyncAction

매개 변수

absolutePath
String

Platform::String

winrt::hstring

텍스트가 기록되는 파일의 경로입니다.

contents
String

Platform::String

winrt::hstring

쓸 텍스트입니다.

반환

이 메서드가 완료되면 개체 또는 값이 반환되지 않습니다.

특성

예제

이 예제에서는 다음과 같이 [writeTextAsync(absolutePath, contents)를 사용하여 의 경로에 있는 absoluteFilePath파일에 임의의 텍스트를 쓰는 방법을 보여 줍니다.

Windows.Storage.FileIO.writeTextAsync(absoluteFilePath, "Swift as a shadow").then(function () {
    // Add code to do something after the text is written to the file
});

writeTextAsync 메서드에는 반환 값이 없지만 샘플에서 볼 수 있듯이 다음 또는 완료 를 사용하여 함수를 선언하고 텍스트가 파일에 기록된 후에도 추가 작업을 수행할 수 있습니다.

설명

이 메서드는 바이트 순서 표시의 존재에 따라 파일의 인코딩을 자동으로 검색하려고 시도합니다. 인코딩을 검색할 수 없는 경우 메서드 오버로드에서 호출자가 지정한 인코딩이 사용됩니다.

추가 정보

적용 대상

WriteTextAsync(String, String, UnicodeEncoding)

지정된 문자 인코딩을 사용하여 지정된 경로 또는 URI(Uniform Resource Identifier)의 파일에 텍스트를 씁니다.

public:
 static IAsyncAction ^ WriteTextAsync(Platform::String ^ absolutePath, Platform::String ^ contents, UnicodeEncoding encoding);
/// [Windows.Foundation.Metadata.Overload("WriteTextWithEncodingAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncAction WriteTextAsync(winrt::hstring const& absolutePath, winrt::hstring const& contents, UnicodeEncoding const& encoding);
[Windows.Foundation.Metadata.Overload("WriteTextWithEncodingAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncAction WriteTextAsync(string absolutePath, string contents, UnicodeEncoding encoding);
function writeTextAsync(absolutePath, contents, encoding)
Public Shared Function WriteTextAsync (absolutePath As String, contents As String, encoding As UnicodeEncoding) As IAsyncAction

매개 변수

absolutePath
String

Platform::String

winrt::hstring

텍스트가 기록되는 파일의 경로입니다.

contents
String

Platform::String

winrt::hstring

쓸 텍스트입니다.

encoding
UnicodeEncoding

파일의 문자 인코딩입니다.

반환

이 메서드가 완료되면 개체 또는 값이 반환되지 않습니다.

특성

추가 정보

적용 대상