文件格式为:
0  0
1  2
3  3
4  5
6  7
8  9
10  11如何一行一行的读出来,并能识别出其中的数字,如:0,0,1,2,3,3,4,5,6,

解决方案 »

  1.   

    var
    F: TextFile;
    s:string;
    ms:TStringList;
    begin
    AssignFile(F,'文件路径');
    ms:=TStringList.Create;
    Reset(F);
    while not Eof(F) do
    begin
    Readln(F,S);
    ms.Add(S);
    end;
    CloseFile(F);
    end;
      

  2.   

    做了一个过程,用于分离数字
    procedure getnum(str:string);
    var
    i,start,len:integer;
    s:string;
    begin
    s:=str;
    len:=length(s);
    if len>0 then
    begin
    start:=1;
    for i:=1 to len do
       if ord(s[i])=32 then
          begin
          form1.memo1.Lines.Add(copy(s,start,i-start));
          start:=i+1;
          end;
    if start<len then
       form1.memo1.Lines.Add(copy(s,start,len-start+1));
    end;
    end;////然后在下面的语句调用该过程即可
    var 
    F: TextFile; 
    s:string; 
    ms:TStringList; 
    begin 
    AssignFile(F, '文件路径 '); 
    ms:=TStringList.Create; 
    Reset(F); 
    while not Eof(F) do 
    begin 
    Readln(F,S);
    getnum(s); 
    end; 
    CloseFile(F); 
    end;