delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks
读文件时,统计行数,为何比实际的多一行 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061016105832236.html
我的程序如下,现象是如果boat.txt中有10行,total的结果是11,在输出的boat1中最后多的一行是0   0   为什么,我换成fortran程序total的结果就是10   ??  
    var  
  g,f:textfile;  
  i,j,scale,multiple,total:integer;  
  xmax,ymax,xmin,ymin:integer;  
  nn,nx,ny,nb:integer;                        
   
  begin  
      assignfile(f,'E:\kong\delphi\picture\boat.txt');  
      assignfile(g,'E:\kong\delphi\picture\boat1.txt');  
      reset(f);  
      rewrite(g);  
   
      total:=0;  
      while   not   eof(f)   do  
   
      begin  
   
      readln(f,i,j);  
      writeln(g,i,j);  
   
   
   
        total:=total+1;  
   
      end;  
      closefile(f);  
      closefile(g);  
   
      memo1.lines.Add(inttostr(total));  
   
   
  end;  
  end.

期待大侠的回答

有些文本在末尾有空行,fortran可能没有把这个算进去。你用二进制编辑器看看?

posted on 2008-12-19 10:01 delphi2007 阅读(293) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。