我想把文本文件读入到TMEMO控件中,用它的LINES属性可得到某一行,然后用字符串函数可以确定字符的列,这时再在MEMO中写入数据就可以了。

解决方案 »

  1.   

    929:
    文件比较大.我能不能用TFileStream.(CREATE,SEEK,WRITE)
    可运行时总异常终了.
      

  2.   

    TFileStream是文本文件操作的不错方式
      

  3.   

    function replace_x_y(textfilename:string;row,col,length:integer;replacestring:string);
    var i:integer;
        f,f1:textfile;
        newline,stringline:string;
    begin
      assignfile (f,testfilename);
      assignfile (f1,"temp");
      while .not. eof(f)
        begin
          readln(f,stringline);
          if i = row
            newline := format('%s%s%s',[copy  (stringline,1,col+1),replacestring,copy(stringline,col+length+1,strlength(stringline)-col-length)]);
       stringline := newline;
        endi
      writeln(f1,stringline);
       end;
      {change f1 to f}
    end;
      

  4.   

    copy(source string,index ,count);
      

  5.   

    最好先把全文读入内存,在内存里处理后,重新写入文件。
    有完整 C 代码,需要请 mail me!
    [email protected]