Site icon TestingDocs.com

Write to a file with RAPTOR flowchart

Introduction

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.

( https://www.testingdocs.com/reading-a-file-in-the-raptor-flowchart/)

Redirect_Output

To write to a file in the flowchart, we have to redirect the output to the file using
the function:

Redirect_Output(fileName)

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:

Redirect_Output(False)

Flowchart Example

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.

Redirect_Output(“output_raptor.txt”)

 

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:

Redirect_Output(false)

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.

Redirect_Output(true)

Append to an existing file

To append to an existing file we can use the following RAPTOR statement.

Redirect_Output_Append(“output.txt”)

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

RAPTOR tutorials page: https://www.testingdocs.com/raptor-a-flowchart-tool/

RAPTOR official website: https://raptor.martincarlisle.com/

Exit mobile version