如何在二进制文件中的特定位置插入文本。 [英] how to insert a text at particular position in Binary file .

查看:73
本文介绍了如何在二进制文件中的特定位置插入文本。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个二进制文件,我需要插入一个单词。



i使用下面的代码:

  string  strFile = File.ReadAllText(outputFile); 
strFile = Regex.Replace(strFile, @ (。)(\ * p\dx \\ \\ dY) @ $ 1& l0L $ 1 $ 2);
File.WriteAllText(outputFile,strFile);





但是在写完文件后,实际的文件内容已经发生了变化但是它不应该更改除插入以外的任何其他内容。那么写入二进制文件的正确方法是什么?

解决方案

1& l0L


< blockquote> 1


2);
File.WriteAllText(outputFile,strFile);





但是在写完文件之后,实际的文件内容已经发生了变化,但除了插入之外不应该改变任何其他内容。那么什么是写入二进制文件的正确方法?


Hi ,
I have one binary file , i need to insert one word in this .

i am using below code :

string strFile = File.ReadAllText(outputFile);
    strFile = Regex.Replace(strFile, @"(.)(\*p\dx\dY)", @"$1&l0L$1$2");
  File.WriteAllText(outputFile, strFile);



but after writing the file , actual file content has got change but it should not change anything else except insertion .So what should be the right way to write into binary file ?

解决方案

1&l0L


1


2"); File.WriteAllText(outputFile, strFile);



but after writing the file , actual file content has got change but it should not change anything else except insertion .So what should be the right way to write into binary file ?


这篇关于如何在二进制文件中的特定位置插入文本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆