Asynchronous loading of text files in Metro/C++/DirectX applications

By just adding a simple modification to the existing ReadDataAsync function, we can load text files asynchronously:

You can load files using the following code (don’t forget it is asynchronous.

auto loadTextTask = ReadStringAsync(L"Assets\\Text.txt")
                                   .then([this](Platform::String^ text)
{
	m_text = text;
});

Enjoy.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Last updated by at .