title: what is wrong with my file writing in c++/cx for metro app?
body: <p>I am using the following code to try to write to a file:</p>
  
  <pre><code>StorageFolder ^localFolder = ApplicationData::Current-&gt;LocalFolder;
  concurrency::task&lt;StorageFile^&gt; fileOperation = localFolder-&gt;CreateFileAsync("data.txt", CreationCollisionOption::ReplaceExisting);
  fileOperation.then([this](StorageFile^ sampleFile)
  {
      ::Globalization::DateTimeFormatting::DateTimeFormatter("longtime");
      Platform::String ^str; // other str stuff here
  
      return FileIO::WriteTextAsync(sampleFile, str);
  }).then([this](concurrency::task&lt;void&gt; previousOperation) {
      try {
          previousOperation.get();
      } catch (Platform::Exception^) {
      }
  });
  </code></pre>
  
  <p>fixed the error thanks to 'Sometimes A Developer'</p>
  
  <p>I got the code from here: 
  <a href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh700361.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh700361.aspx</a></p>