用C#写入文本文件 [英] Writing to a text file in C#

查看:133
本文介绍了用C#写入文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

有人知道如何在C#中写入现有文本文件的指定位置吗?
如果有人能对此表示感谢,我将非常感激.谢谢大家,复活节快乐!

Hello!

Does anyone knw how to write to a specified location of an existing text file in C#?
I will be very thnkful if anyone can commnt on this.Thank u and Happy Easter to all!!!

推荐答案

只有在新文本是与要替换的原始文本的长度相同.如果是这样,则在MSDN上查找FileStream.Seek(下面的链接).

http://msdn.microsoft.com/en -us/library/system.io.filestream.seek(v = VS.100).aspx [
You can only do this if the new text is the same length as the original text being replaced. If that''s true, then lookup FileStream.Seek on MSDN (link below).

http://msdn.microsoft.com/en-us/library/system.io.filestream.seek(v=VS.100).aspx[^]


这篇关于用C#写入文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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