Create the following diagram to programmatically open, write to, and close a text file.
Customize the gray sections for your unique programming goals.
|Open, create, or replace a file by using the Open/Create/Replace File node and specifying its precise behavior. To access the enumerated list of possible behaviors, create a constant from the operation input of the node.|
|After the file opens, a unique identifier called a refnum represents the file. A file refnum is required for most nodes that process files.|
|Process the file by using a file I/O node from the File and Dialog palette category. You can interact with binary or text files. In this example, Write to Text File writes Hello world to the file represented by the file refnum.|
|Close the file to release the object from memory and avoid potential errors. If you do not close a file, LabVIEW cannot close the reference until the VI that opened the file finishes executing.|