【问题标题】:Copy Stream to New File将流复制到新文件
【发布时间】:2019-08-07 14:26:48
【问题描述】:

需要将流保存到新文件

Windows、.NET

        using (FileStream newFileStream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
        {
            await decryptedStream.CopyToAsync(newFileStream);
        }

在 FilePath 处写入新文件。但是收到错误;“无法访问已关闭的文件”

【问题讨论】:

  • 解密流在哪里
  • Stream decryptedStream 已被数据填充。

标签: c# .net stream filestream


【解决方案1】:

找出问题所在。

inputStream 在设置为复制到输出文件流之前已被处理;导致错误“无法访问关闭的文件”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-03
    • 2010-10-28
    • 2018-12-29
    • 1970-01-01
    • 2018-06-29
    相关资源
    最近更新 更多