문제

I searched and found this but it's not available for Windows Phone 8 and only works for Windows Store apps:

http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileio.writebytesasync

How do I do this in WP8?

도움이 되었습니까?

해결책

You can use binary writer:

byte[] buffer;   

using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
{

  using (IsolatedStorageFileStream FS = new IsolatedStorageFileStream(fileName, FileMode.Create, ISF))
  {
    using (BinaryWriter BW = new BinaryWriter(FS))
    {
      BW.Write(buffer, 0, buffer.Lenght);
    }
  }
}

Or make it simpler as @KooKiz said:

using (IsolatedStorageFileStream FS = new IsolatedStorageFileStream(fileName, FileMode.Create, ISF))
 {
     FS.Write(buffer, 0, buffer.Lenght);    
 }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top