Flowgorithm

Read Text File using Flowgorithm

Read Text File in Flowgorithm

In this tutorial, we will learn to read text file using the Flowgorithm flowchart application. Flowgorithm 3.0 supports reading/writing text files.

The text file should be created or placed in the same directory. Flowgorithm will look for the file in the same folder as in the flowchart as the flowchart is located.

New Symbols

New flowchart file symbols that support the read/write operations on files.

Sample Flowchart

We will design a flowchart that reads the contents of the text file and echoes the file contents to the standard output console.

Let’s get started.

Launch Flowgorithm 3.0 application.

Create and Save the flowchart.

Create a text file in the same directory as the flowchart. For example, let’s create a sample ‘input.txt’ file and add some sample text content to the file.

Declare a String variable to hold each text line in the file.

Add an Open file symbol to the flowchart to open a file to read the contents.

Specify the file name to read and check the file Mode: Read

 

File Open Read Mode Flowgorithm

 

The file is opened in the Read mode. Add a loop to read each line.

Specify the loop exit condition as  !EOF()

! is a NOT unary operator.

EOF()

EOF() is a file-related function. It stands for End-of-File. This function returns TRUE if the end of the file is reached. This function is used to read an open file. So, to continue processing an open file, we have to check the condition that if !EOF() is TRUE.

Inside the loop, add a Read symbol.

The file read symbol reads the file and stores the value in the specified variable. In this case, each file text line is stored in the variable called ‘line’

File Read Statement Flowgorithm

 

Add an output symbol to display the content in the console window. In the Output symbol, enter the variable line.

After the loop add a file Close symbol. It’s a best practice to close the files opened by the applications.

 

 

Read TextFile-Flowgorithm 3 Flowchart-TestingDocs

Flowchart Output

Run the flowchart to read and view the file contents on the output console window.

 

Read Text File Flowgorithm3 Flowchart Example

That’s it. We are done with the flowchart.

 

Flowgorithm Tutorials

Flowgorithm flowchart tutorials on this website: