简体   繁体   English

如何将字节数组粘贴到文件c#中?

[英]How to paste a byte array into a file c#?

When my program starts, i get the byte array of a file (file a), then i send that byte array to paste it into another file (file b), like creating a copy of my first file. 当我的程序启动时,我得到一个文件的字节数组(文件a),然后我发送该字节数组将其粘贴到另一个文件(文件b),就像创建我的第一个文件的副本。

The Question is, how do i open the "file b" and paste the binary info to create a copy of my "file a"? 问题是,如何打开“文件b”并粘贴二进制信息以创建我的“文件a”的副本?

You can write a byte[] directly to a file path. 您可以直接将byte []写入文件路径。

using System.IO;

byte[] byteArray;
string path = @"C:\fileB.txt"

File.WriteAllBytes(path, byteArray);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM