readline and writeline
读到要改的行就就 writeline 呵呵

解决方案 »

  1.   

    逐行读写,
    readline/writeline
      

  2.   

    you can read a line from the old text file,then write it to a new text file
    when you read all lines in the old text file,delete it.Then change the filename of the new text file.That is OK?
      

  3.   

    请问斑竹知道要修改的位置吗?如果知道那就很简单拉,只要用FileStream的Seek方法定位到这个位置然后再写。但是应该注意,在文件写的时候永远不能插入数据,只能覆盖。也可以用另一种方法,那就是先不写入文件,而是用StringBuilder来处理要进行写的数据,在最后再写入文件。
      

  4.   

    支持使用seek的方法,不过觉得每次都要定位,很烦的。而且,我觉得用appendText可以插入数据啊。
      

  5.   

    呵呵,是吗?在seek定位之后,再定位好的位置追加东东会覆盖后面的吗?没试过,如果会覆盖,那到是差了一截,如果不是覆盖,不知道差在哪儿?