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