How to resolve the algorithm Read a file line by line step by step in the ERRE programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Read a file line by line step by step in the ERRE programming language

Table of Contents

Problem Statement

Read a file one line at a time, as opposed to reading the entire file at once.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Read a file line by line step by step in the ERRE programming language

Source code in the erre programming language

PROGRAM LETTURA

EXCEPTION
    FERROR%=TRUE        ! si e' verificata l'eccezione !
    PRINT("Il file richiesto non esiste .....")
END EXCEPTION

BEGIN
    FERROR%=FALSE
    PRINT("Nome del file";)
    INPUT(FILE$)      ! chiede il nome del file
    OPEN("I",1,FILE$) ! apre un file sequenziale in lettura
      IF NOT FERROR% THEN
         REPEAT
           INPUT(LINE,#1,CH$)   ! legge una riga ....
           PRINT(CH$)           ! ... la stampa ...
         UNTIL EOF(1)           ! ... fine a fine file
      END IF
      PRINT
    CLOSE(1)          ! chiude il file
END PROGRAM

  

You may also check:How to resolve the algorithm Naming conventions step by step in the Delphi programming language
You may also check:How to resolve the algorithm Bitmap/Bézier curves/Quadratic step by step in the FBSL programming language
You may also check:How to resolve the algorithm Bitwise operations step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Logistic curve fitting in epidemiology step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Quine step by step in the dc programming language