In this post, we will learn how to write to a file using the Raptor flowchart. The standard Output flowchart symbol is used to write to the file.
The standard output to the flowchart is the MasterConsole window that is displayed on the computer monitor screen. We can override this behavior by Redirecting the output to the file. This is much canonical to reading from a file.
To write to a file in the flowchart, we have to redirect the output to the file using
The function call would create a new file or overwrite an existing file with the filename. After file processing we can turn off the redirection using the statement:
Let’s create a flowchart that will write two lines of output to the file using the RAPTOR flowchart application. Assume the filename is output_raptor.txt. The file would be created in the same directory to which the RAPTOR flowchart is present.
To switch the output to the file: Drag & drop a Call symbol and the below statement.
All the Output flowchart symbols would write to the file instead of displaying in the MasterConsole window. Add two output statements. Save the flowchart and run the flowchart.
A new file would be created with the flowchart output.
Turn On/Off File Redirection
To Turn off the file output redirection, we can use the statement:
To turn on the file output redirection, we can use the statement. This will prompt for the file during the flowchart run. Alternatively, we can append to the existing file.
Append to an existing file
To append to an existing file we can use the following RAPTOR statement.
This statement would open an existing file in an append mode. All the flowchart output would be appended to the file at the end. If the specified file is not present a new file would be created.
RAPTOR tutorials page: https://www.testingdocs.com/raptor-a-flowchart-tool/
RAPTOR official website: https://raptor.martincarlisle.com/