Hi all:
I use WRL method for file access.
However, now I usually OpenAsync() failed.
Because [operation->GetResults(&PanoramaFile)] usually get null pointer. (Sometimes it's ok!)
The code is as below.
(The full code
http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/f79d829f-8445-454a-b8d6-83cc3bc6b615)
===========================================================================================
HString hstrFileName;
hstrFileName.Set(L"sample.txt");
// Call CreteFileAsync
__FIAsyncOperation_1_Windows__CStorage__CStorageFile_t * operation;
hr = pStorageFolder->CreateFileAsync(hstrFileName.Get(),
CreationCollisionOption::CreationCollisionOption_ReplaceExisting,
&operation);
if (FAILED(hr))
{
::Microsoft::WRL::Details::RaiseException(hr);
}
operation->GetResults(&PanoramaFile);
__RPC__deref_out_opt __FIAsyncOperation_1_Windows__CStorage__CStreams__CIRandomAccessStream *RandomStream;
PanoramaFile->OpenAsync(FileAccessMode_ReadWrite, &RandomStream);
===========================================================================================