[fpc-pascal]Loop Question!!!!

Jacob Bager dj_alf at mail.tele.dk
Tue Nov 28 19:36:43 CET 2000


Somebody help, this is a question of the teoretical type.

Here the scenario:

i have a text with line diffenrenting like this:
AAA
AAA
AAA
AAA
AAA
AAA
AAA
AAA
AAB
AAB
AAB
AAB
AAB

....and so on.

I want to split up the values in different files so that all the AAA are put in the file AAA, and all AAB are put in AAB etc.

look at my rutine and tell what im doing wrong. I can tell the program when i shouldt start with a new file, and writing a new line 
but i can't get it to close the file, when the sequence stops.

   begin
     readln(asc_file,buffer);
     inc(cell_count);
      strPcopy(file_array,buffer);

      file_check := '';
      for i := 2 to 4 do begin
          file_check := file_check + file_array[i];
      end;


      if (file_check <> old_file_check) then
      begin
        igang := true;
        writeln('start');
        readln;
      end;

      if (file_check = old_file_check) then
      begin
        writeln('Linie');
      end;


      if (file_check = old_file_check) and (igang = true) then
      begin
        igang := false;
        write('Slut');
        readln;
      end;


      old_file_check := '';
      old_file_check := file_check;
      file_check := '';

   end;


This is only an example... so of...

Hope some on can help me!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20001128/5cf7e525/attachment.html>


More information about the fpc-pascal mailing list