我从一个文件里面读出数据,用Writeln往另外一个文件里面写数据,但是每次后面的1-2行数据都写不进去。显示每次读的数据是正确的,很奇怪呀!请高手帮忙,谢谢!

解决方案 »

  1.   

    While not eof(InputFile) do
      begin
        ReadLn(InputFile,sLine);
        ProcessDataLine(sLine,sStr);
        if level = StrToInt(sStr[2]) then
        begin
          if (StrToFloat(sStr[3])= rUpLati) and (StrToFloat(sStr[4]) = rLeftLong)  then
              begin            aValue[1,1] := StrToFloat(sStr[5]);
                aValue[1,2] := 1;          end;
          if (StrToFloat(sStr[3])= rUpLati)and (StrToFloat(sStr[4]) = rRightLong) then
              begin
                aValue[2,1] := StrToFloat(sStr[5]);
                //Showmessage(sstr[5]+','+sstr[1]+','+sstr[2]+','+sstr[3]+','+sstr[4]);
                aValue[2,2] := 1;          end;      if (StrToFloat(sStr[3]) = rDownLati) and (StrToFloat(sStr[4]) = rLeftLong) then
              begin
                aValue[3,1] := StrToFloat(sStr[5]);
                aValue[3,2] := 1;          end;
          if (StrToFloat(sStr[3]) = rDownLati) and (StrToFloat(sStr[4]) = rRightLong) then
              begin
                aValue[4,1] := StrToFloat(sStr[5]);
                aValue[4,2] := 1;
                //showmessage(FloatToStr(aValue[4,2]));
              end;      if (aValue[1,2] = 0) or (aValue[2,2] = 0) or  (aValue[3,2] = 0) or  (aValue[4,2] = 0)  then
          begin
            Continue;
          end
          else
          begin
            //Showmessage(sstr[5]+','+sstr[1]+','+sstr[2]+','+sstr[3]+','+sstr[4]);
            //Showmessage(FloatToStr(aValue[1,1])+','+FloatToStr(aValue[2,1])+','+FloatToStr(aValue[3,1])+','+FloatToStr(aValue[4,1]));
            Writeln(OutputFile,'时间,气压,纬度,经度,值');
            rInter := (aValue[1,1]*Cx1 + aValue[2,1]*Cx2)* Cy2 +(aValue[3,1]*Cx1 + aValue[4,1]*Cx2)*Cy1;
            rMean := (aValue[1,1] + aValue[2,1] + aValue[3,1]+ aValue[4,1])/4;
            Writeln(OutputFile,sStr[1]+','+sStr[2]+','+sStr[3]+','+sStr[4]+',',rInter:6:2);    就是这一句!
            For j := 1 to 4 do aValue[j,2] := 0;
          end; 
        end;      
    end;   
      end;