Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2000-11

Loop Question!!!!

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jacob Bager

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!

Tobias Hermann
to Jacob Bager

huh? I only read quickly over your code, but didn't get the point, what is has to do with what you want it to do...

I thought you have text lines and want to filter them and sort it in different files... reading the source text from a file and write all AAA lines in the file AAA, etc. But what are you doing here? Perhaps I'm too tired to understand your code :-) its 1.39 a.m. and I'll just go to bed :-))

Bye,
Tobi

Earlier message 27 lines
----- Original Message ----- From: Jacob Bager To: Sent: Tuesday, November 28, 2000 7:36 PM Subject: [fpc-pascal]Loop Question!!!! 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.