Flowgorithm File I/O Symbols
Flowgorithm File I/O Symbols
In this tutorial, we will learn about Flowgorithm File I/O symbols. Flowgorithm 3.0 supports the reading and writing of text files in flowcharts.
A file is a collection of data that resides on a hard disk or other persistent storage device. The common file type is text files with a *.txt extension. Text files are human-readable. We can create text files on the Windows operating system using File Explorer and other text editor software. Common text editor software examples are:
Notepad, Notepad++, TextPad, etc.
File I/O Symbols
Four new flowchart symbols are introduced in this version to support this feature. The new symbols are as follows:
- Open
- Read
- Write
- Close
The default File symbols and the usage are as follows:
Symbol | Name | Purpose |
Open |
An Open statement allows reading or writing operations on a file in the flowchart. This will create a file handle for the file in the flowchart. | |
Read | A Read statement reads a value from the open file and stores it in the flowchart variable. | |
Write | A Write statement evaluates an expression and writes the result to the open file. | |
Close | A Close statement closes an open file. This makes the file available to the operating system. |
XML Syntax
The File symbols and the XML tags will be represented in the .fprg flowchart file.
XML | Flowchart File I/O Symbols |
<open expression=”"input.txt"” mode=”read”/>
The XML tag for the file Open symbol. The file is input.txt, and the file mode is Read. |
|
<read variable=”line”/>
The XML tag for the Read file symbol. Each line in the file would be stored in the specified variable line. |
|
<write expression=”str”/>
The XML tag for the Write file symbol would write the contents of the string variable str to the file. |
|
<close/>
The XML tag for the Close file symbol. This would close the file handle in the flowchart. |
Some examples that use the File I/O Symbols:
—
Flowgorithm Tutorials
Flowgorithm flowchart tutorials on this website:
https://www.testingdocs.com/flowgorithm-flowchart-tutorial/