Share via


PathIO.ReadTextAsync 메서드

정의

오버로드

ReadTextAsync(String)

지정된 경로 또는 URI(Uniform Resource Identifier)에서 파일의 내용을 읽고 텍스트를 반환합니다.

ReadTextAsync(String, UnicodeEncoding)

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

ReadTextAsync(String)

지정된 경로 또는 URI(Uniform Resource Identifier)에서 파일의 내용을 읽고 텍스트를 반환합니다.

public:
 static IAsyncOperation<Platform::String ^> ^ ReadTextAsync(Platform::String ^ absolutePath);
/// [Windows.Foundation.Metadata.Overload("ReadTextAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<winrt::hstring> ReadTextAsync(winrt::hstring const& absolutePath);
[Windows.Foundation.Metadata.Overload("ReadTextAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<string> ReadTextAsync(string absolutePath);
function readTextAsync(absolutePath)
Public Shared Function ReadTextAsync (absolutePath As String) As IAsyncOperation(Of String)

매개 변수

absolutePath
String

Platform::String

winrt::hstring

읽을 파일의 경로입니다.

반환

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

이 메서드가 성공적으로 완료되면 파일의 내용을 텍스트 문자열로 반환합니다.

특성

예제

이 예제에서는 readTextAsync(absolutePath)를 사용하여 다음과 같이 경로 absoluteFilePath 의 파일에서 텍스트를 읽는 방법을 보여 줍니다.

Windows.Storage.PathIO.readTextAsync(absoluteFilePath).then(function (contents) {
    // Add code to process the text read from the file
});

그런 다음 또는 완료를 사용하여 파일에서 읽은 텍스트를 캡처하고 처리하는 함수를 선언할 수 있습니다. readTextAsync 메서드가 완료되면 텍스트가 문자열 개체(contents예에서)로 이 함수에 전달됩니다.

추가 정보

적용 대상

ReadTextAsync(String, UnicodeEncoding)

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

public:
 static IAsyncOperation<Platform::String ^> ^ ReadTextAsync(Platform::String ^ absolutePath, UnicodeEncoding encoding);
/// [Windows.Foundation.Metadata.Overload("ReadTextWithEncodingAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<winrt::hstring> ReadTextAsync(winrt::hstring const& absolutePath, UnicodeEncoding const& encoding);
[Windows.Foundation.Metadata.Overload("ReadTextWithEncodingAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<string> ReadTextAsync(string absolutePath, UnicodeEncoding encoding);
function readTextAsync(absolutePath, encoding)
Public Shared Function ReadTextAsync (absolutePath As String, encoding As UnicodeEncoding) As IAsyncOperation(Of String)

매개 변수

absolutePath
String

Platform::String

winrt::hstring

읽을 파일의 경로입니다.

encoding
UnicodeEncoding

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

반환

IAsyncOperation<String>

IAsyncOperation<Platform::String>

IAsyncOperation<winrt::hstring>

이 메서드가 성공적으로 완료되면 파일의 내용을 텍스트 문자열로 반환합니다.

특성

추가 정보

적용 대상