VARKON Version 1.15 1997-10-16


          MACRO MODULE count_lines(STRING filename*80 >"Enter name of file !");

          STRING line*132;
          FILE   f;
          INT    count;

          BEGINMODULE

          !*
          !***Open the file for read access.
          !*
             open(f,"R",filename); 
          !*
          !***Loop and read lines until end of file.
          !*
             count:=0;
             loop:
             line:=inlin(f);
          !*
          !***If a line was read increase counter and loop again.
          !*
             IF iostat(f) = 0 THEN
             count:=count + 1;
             GOTO loop;
          !*
          !***If no line was read there are no more lines to read. Close the file and
          !***display the result in a VARKON listwindow.
          !*
             ELSE
             close(f);
             lst_ini("Result of linecount for file ="+filename);
             lst_lin("Count="+str(count));
             lst_exi();
             ENDIF;

          ENDMODULE


Copyright © Microform AB Henningholmsgatan 4  S-703 69 Örebro SWEDEN  E-mail:  info@microform.se

VARKON Homepage Index